0.0.1 • Published 10 years ago
split-by v0.0.1
split-by
Split an array or a string by another array or string.
example
var splitBy = require('split-by');
var xs = [ 3, 4, 0, 0, 0, 2, 1, 0, 5, 0, 0, 0, 5, 2, 1 ];
var res = splitBy(xs, [ 0, 0, 0 ]);
console.dir(res);
output:
[ [ 3, 4 ], [ 2, 1, 0, 5 ], [ 5, 2, 1 ] ]
methods
var splitBy = require('split-by')
splitBy(xs, ys)
Return an array of xs
split by ys
, not including the elements split on.
install
With npm do:
npm install split-by
license
MIT