swapRanges$ - nodef/extra-array GitHub Wiki
Exchange two ranges of values!
Alternatives: swapRanges, swapRanges$. Similar: swap, swapRanges.
function swapRanges$(x, i, I, j, J)
// x: an array (updated!)
// i: begin index of first range
// I: end index of first range (exclusive)
// j: begin index of second range
// J: end index of second range (exclusive)
const xarray = require('extra-array');
// Example for swapRanges
var x = [1, 2, 3, 4, 5];
xarray.swapRanges$(x, 1, 3, 3, 5);
// → [ 1, 4, 5, 2, 3 ] (x updated!)