-
Notifications
You must be signed in to change notification settings - Fork 5
cut
Subhajit Sahu edited this page May 3, 2023
·
23 revisions
Break array when test passes.
function cut(x, ft)
// x: an array
// ft: test function (v, i, x)
const xarray = require('extra-array');
var x = [1, 2, 3, 4, 5];
xarray.cut(x, [1, 3]);
// → [ [ 1 ], [ 2, 3 ], [ 4, 5 ] ]
xarray.cut(x, [0, 4]);
// → [ [], [ 1, 2, 3, 4 ], [ 5 ] ]