Breaks iterable at given indices.
Alternatives: cut, cutRight, cutAt, cutAtRight.
Similar: cut, split, group.
This is part of package extra-iterable.
This is browserified, minified version of @extra-iterable/cut-at.
It is exported as global variable iterable_cutAt.
CDN: unpkg, jsDelivr.
iterable.cutAt(x, is);
// x: an iterable
// is: split indices (sorted)
const iterable = require("extra-iterable");
var x = [1, 2, 3, 4, 5];
[...iterable.cutAt(x, [1, 3])];
// [ [ 1 ], [ 2, 3 ], [ 4, 5 ] ]
[...iterable.cutAt(x, [0, 4])];
// [ [], [ 1, 2, 3, 4 ], [ 5 ] ]