JSPM

@extra-array/cut

2.9.44
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q67778F
  • License MIT

Breaks array at given indices.

Package Exports

  • @extra-array/cut

Readme

Breaks array at given indices. 🏃 📼 📦 🌔 📒

Alternatives: cut, cutRight.
Similar: cut, split.
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