JSPM

@extra-array/cut

2.8.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q59983F
  • License MIT

Breaks array at given indices.

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]]

references