Skip to content

array-like/swap

Repository files navigation

ArrayLike value swapping for JavaScript. See docs.

import {swapRanges} from '@array-like/swap';
import {alloc} from '@array-like/alloc';
import {iota} from '@array-like/iota';

const n = 6;
const a = alloc(n);
iota(a, 0, n, 0);
const b = alloc(n);
iota(b, 0, n, 0);

swapRanges(a, 0, 3, b, 3);
a; // 3 4 5 3 4 5
b; // 0 1 2 0 1 2

License Version Tests Dependencies GitHub issues Downloads

Code issues Code maintainability Code coverage (cov) Code technical debt Documentation Package size