Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
split an array or string by another array or string
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
example
test
.travis.yml
index.js
package.json
readme.markdown

readme.markdown

split-by

Split an array or a string by another array or string.

build status

testling badge

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

Something went wrong with that request. Please try again.