@extra-array/split
v2.10.19
Published
Breaks array considering test as separator.
Readme
Breaks array considering test as separator. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:
This is part of package extra-array.
array.split(x, fn);
// x: an array
// fn: test function (v, i, x)const array = require("extra-array");
var x = [1, 2, 2, 3, 5, 4, 4, 7];
array.split(x, v => v % 2 === 0);
// [ [ 1 ], [ 3, 5 ], [ 7 ] ]
var x = [2, 4, 5, 6, 8];
array.split(x, v => v % 2 === 0);
// [ [ 5 ] ]