UNPKG

@mightyplow/jslib

Version:

js helpers library

11 lines (10 loc) 437 B
export default function split(ar, chunkSize) { return function innerSplit() { var rest = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; if (!rest.length) { return result; } return innerSplit(rest.slice(chunkSize), result.concat([rest.slice(0, chunkSize)])); }(ar); }