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