array-divide
Divide an array into multiple arrays each of whom have the same number of items
arrayDivide(['a', 'b', 'c', 'd'], 2);
arrayDivide(['a', 'b', 'c', 'd'], 3);
Installation
Package managers
npm install array-divide
bower install array-divide
const arrayDivide = require('shinnn/array-divide');
Standalone
Download the script file directly.
API
arrayDivide(array, count)
array: Array
count: Number
(the maximum number of items)
Return: Array
(a new array and doesn't break the original one)
arrayDivide(['a', 'b', 'c', 'd'], 100);
arrayDivide([], 100);
arrayDivide(['a', 'b', 'c'], 0);
arrayDivide(arguments, 1);
License
Copyright (c) 2015 Shinnosuke Watanabe
Licensed under the MIT License.