@extra-array/swap-update.min
TypeScript icon, indicating that this package has built-in type declarations

2.10.19 • Public • Published

Exchanges two values. 📦 😺 🏃 📼 🌔 📜 📰 📘

Alternatives: swap, swap$.

This is part of package extra-array.

This is browserified, minified version of @extra-array/swap-update.
It is exported as global variable array_swap$.
CDN: unpkg, jsDelivr.


array.swap$(x, i, j);
// x: an array (updated)
// i: an index
// j: another index
// → x
const array = require("extra-array");

var x = [1, 2, 3, 4];
array.swap$(x, 0, 1);
// [ 2, 1, 3, 4 ]

x;
// [ 2, 1, 3, 4 ]

var x = [1, 2, 3, 4];
array.swap$(x, 0, 3);
// [ 4, 2, 3, 1 ]


References

Package Sidebar

Install

npm i @extra-array/swap-update.min

Weekly Downloads

1

Version

2.10.19

License

MIT

Unpacked Size

5.27 kB

Total Files

8

Last publish

Collaborators

  • wolfram77