JSPM

@extra-array/cut

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

Breaks array at given indices. :running: :package: :moon:

Package Exports

  • @extra-array/cut

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@extra-array/cut) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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)
// --> [...pieces]
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