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

[enhancement] partitionMuti #2249

Closed
cabbage89 opened this issue Jul 28, 2015 · 3 comments
Closed

[enhancement] partitionMuti #2249

cabbage89 opened this issue Jul 28, 2015 · 3 comments

Comments

@cabbage89
Copy link

function partitionMuti(array,every){

var arr=[];
_.each(array,function(n,index){
var rem = Math.floor(index / every);
if (index% every == 0)
arr[rem] = [];
arr[rem].push(n);
});
return arr;
}

@cabbage89
Copy link
Author

_.partitionMuti([1,2,3,4,5,6,7,8,9],3) == [[1,2,3],[4,5,6],[7,8,9]]

@jdalton
Copy link
Contributor

jdalton commented Jul 28, 2015

It's _.chunk.

@megawac megawac closed this as completed Jul 28, 2015
@megawac
Copy link
Collaborator

megawac commented Jul 28, 2015

Duplicate of #1891 #1919

@megawac megawac mentioned this issue Jul 28, 2015
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

3 participants