Skip to content
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

Strange _.rearg / _.reduce behaviour #5801

Open
neizerth opened this issue Jan 11, 2024 · 0 comments
Open

Strange _.rearg / _.reduce behaviour #5801

neizerth opened this issue Jan 11, 2024 · 0 comments

Comments

@neizerth
Copy link

neizerth commented Jan 11, 2024

Hi!

I have strange issue with rearg and reduce:

const reduce = _.rearg(_.reduce, [1, 2, 0]);

const result = reduce(
    (x, y) => x + y,
    0,
    [4, 5, 10, 11]
);

console.log(typeof result); // function

But when i've changed indexes array to [1, 0, 2]:

const reduce = _.rearg(_.reduce, [1, 0, 2]);

const result = reduce(
    (x, y) => x + y,
    [4, 5, 10, 11],
    0,
);

console.log(typeof result); // number!

What's wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant