Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 373 Bytes

README.md

File metadata and controls

25 lines (16 loc) · 373 Bytes

array-swap

Swapping two items in a javascript array - Array.prototype.swap

Install

$ npm install --save array-swap

Usage

var swap = require('array-swap');

var arr = ['apple', 'orange', 'banana', 'pear'];
arr.swap(1, 3);

// arr will be
// ['apple', 'pear', 'banana', 'orange']

License

MIT © Marko Jankovic