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

Chunk function #2130

Closed
htuscher opened this issue Mar 31, 2015 · 1 comment
Closed

Chunk function #2130

htuscher opened this issue Mar 31, 2015 · 1 comment

Comments

@htuscher
Copy link

It would be really great to have a chunk function which splits an array into n equal parts.

Currently something like this can be done with the following code:

_.chain(container.parameter).groupBy(function (el, idx) {
    return Math.floor(idx / 4);
}).toArray().value();

But having this as _.chunk(array, numberOfChunks); would be really great.

@Florian-R
Copy link
Contributor

See #1919 for a currently discussed PR.

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

No branches or pull requests

2 participants