Package Exports
- @extra-array/cut
Readme
Breaks array at given indices. 🏃 📼 📦 🌔
Alternatives: left, right.
This is part of package extra-array.
array.cut(x, is);
// x: an array
// is: split indices (sorted)
const array = require('extra-array');
var x = [1, 2, 3, 4, 5];
array.cut(x, [1, 3]);
// [[1], [2, 3], [4, 5]]
array.cut(x, [0, 4]);
// [[], [1, 2, 3, 4], [5]]