@extra-array/copy-within.min

Copies part of array within. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Usage no npm install needed!

<script type="module">
  import extraArrayCopyWithinMin from 'https://cdn.skypack.dev/@extra-array/copy-within.min';
</script>

README

Copies part of array within. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Alternatives: copyWithin, copyWithin$.
Similar: copy, copyWithin, moveWithin.

This is part of package extra-array.

This is browserified, minified version of @extra-array/copy-within.
It is exported as global variable array_copyWithin.
CDN: unpkg, jsDelivr.


array.copyWithin(x, [j], [i], [I]);
// x: an array
// j: write index (0)
// i: read start index (0)
// I: read end index (X)
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