partition-size
v1.0.1
Published
Splits an array by size
Downloads
105
Readme
partition-size
Splits an array by size.
Getting started
npm i partition-size
Usage
partitionSize(array, size);
import partitionSize from 'partition-size';
const njs = [
'vivalo',
'3rensho',
'kalavinka',
'level',
'nagasawa',
'umezawa',
'makino'
];
partitionSize(njs, 3); // => [['vivalo', '3rensho', 'kalavinka'], ['level', 'nagasawa', 'umezawa'], ['makino']]
partitionSize([1, 2, 3, 4], 5); // => [[1, 2, 3, 4]]
partitionSize([1, 2, 3, 4], 0); // => [1, 2, 3, 4]
partitionSize([1, 2, 3, 4], -1); // => [1, 2, 3, 4]
partitionSize([1, 2, 3, 4], 'not a number'); // => [1, 2, 3, 4]
Contributing
- Fork it!
- Create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request :D
Test
npm test
License
© sugarshin