rangelib
Use this package to generate numerical ranges and now split arrays with the two quick methods into n items per sub-array or n sub-arrays
Installation
Run this command from your favourite command line
npm install rangelib
Examples
var range = ;/* range = (start_val,end_val) diff=1 */range; // [0, 1, 2, 3, 4]range; // [9, 10, 11,, 12, 13, 14, 15]range; // [0, -1, -2, -3, -4]range; // [1, 0 , -1, -2, -3, -4, -5, -6, -7, -8] /* ranges = (start_val,end_val,diff=1) */ ranges; // [10, 11 , 12, 13, 14]range; // [0, 5, 10, 15]range; // [-10, -8, -6, -4] /* New Method Split an array into n items per sub-array*/ range; // [[1,2],[3,4],[5,6],[7,8]] /* New Method Split an array into n sub-arrays automatically fitting equal items for each*/range // [[1,2,3,4],[5,6,7,8]]
Caught a bug?
- Fork this repository to your own GitHub account and then clone it to your local device
- Link the package to the global module directory:
npm link
- Within the module you want to test your local development instance of rangelib, just link it to the dependencies:
npm link rangejs
. Instead of the default one from npm, node will now use your clone of rangejs!