8000 A way to clone array on purpose when using chain call. · Issue #1323 · lodash/lodash · GitHub
[go: up one dir, main page]

Skip to content

A way to clone array on purpose when using chain call. #1323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
le0nik opened this issue Jul 7, 2015 · 2 comments
Closed

A way to clone array on purpose when using chain call. #1323

le0nik opened this issue Jul 7, 2015 · 2 comments
Labels

Comments

@le0nik
Copy link
le0nik commented Jul 7, 2015

Hello!

In 3.10.0:

var arr = [1, 2, 3];

var arr2 = _.chain(arr)
    .slice()
    .reverse()
    .value();

console.log('arr2: ', arr2); // [3, 2, 1]

console.log('arr: ', arr); // [3, 2, 1]

// in 3.9.3 and prior to it 'console.log(arr);' would return [1, 2, 3]. The initial array would be untouched.

First i'd like to say, that it is unintuitive, undocumented(nothing in the changelog) and it broke a part of our project. Supposing, that the change was intentional(short fusion), the question is: is there a way to clone an array on purpose, considering that _.clone and _.cloneDeep aren't chainable?

Thank you!

@jdalton
Copy link
Member
jdalton commented Jul 7, 2015

Thanks, you found a bug.

@jdalton jdalton added the bug label Jul 7, 2015
@jdalton jdalton closed this as completed in 40ce682 Jul 8, 2015
jdalton added a commit that referenced this issue Jul 10, 2015
jdalton added a commit that referenced this issue Jul 20, 2015
69CC
@lock
Copy link
lock bot commented Jan 20, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants
0