-
Notifications
You must be signed in to change notification settings - Fork 1
cutAt
Subhajit Sahu edited this page Feb 3, 2021
·
9 revisions
Break iterable at given indices.
Alternatives: cut, cutRight, cutAt, cutAtRight.
Similar: cut, split, group.
function cutAt(x, is)
// x: an iterable
// is: split indices (sorted)
const xiterable = require('extra-iterable');
var x = [1, 2, 3, 4, 5];
[...xiterable.cutAt(x, [1, 3])];
// → [[1], [2, 3], [4, 5]]
[...xiterable.cutAt(x, [0, 4])];
// → [[], [1, 2, 3, 4], [5]]