JSFiddle - React, Tailwind, and code Playground
by zainshaikh
JavaScript
window.chunkify = function(list, size) {
var lists = _.groupBy(list, function(a, b) {
return Math.floor(b / size);
});
lists = _.toArray(lists); //Added this to convert the returned object to an array.
return lists;
}
//_.pluck(stooges, 'name');
var d = [{"a":3,"b":4},{"a":3,"b":4},{"a":3,"b":4},{"a":3,"b":4},{"a":3,"b":4},{"a":3,"b":4}]
//var data = ["a1", "a2", "a3", "a4", "a5", "a6", "a9", "a10", "a11", "a12", "a13"];
var n = 5;
var s = _.pluck(d, 'a');
var w= chunkify(d, n);
console.log(w);
console.log(s);