JSPM

@extra-array/copy-within

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

Copies part of array within.

Package Exports

  • @extra-array/copy-within

Readme

Copies part of array within. 🏃 📼 📦 🌔 📒

Alternatives: copyWithin, copyWithin$.
Similar: copy, copyWithin.
This is part of package extra-array.

array.copyWithin(x, [j], [i], [I]);
// x: an array
// j: write index (0)
// i: read start index (0)
// I: read end index (end)
const array = require('extra-array');

var x = [1, 2, 3, 4, 5];
array.copyWithin(x, 3);
// [ 1, 2, 3, 1, 2 ]

array.copyWithin(x, 3, 1);
// [ 1, 2, 3, 2, 3 ]

array.copyWithin(x, 3, 1, 2);
// [ 1, 2, 3, 2, 5 ]

references