1.0.2 • Published 6 years ago

array-shift v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

array-shift

NPM version

Shifts array element up, down or custom

Installation

$ npm install array-shift

Usage

let arrayShift = require('array-shift');

let arr = [1,2,3,4,5];
//  up(array, index)
arrayShift.down(arr, 0);
console.log(arr); // -> [2,1,3,4,5]

//  down(array, index)
arrayShift.up(arr, 0);
console.log(arr); // -> [1,2,3,4,5]

//  custom(array, fromIndex, toIndex)
arrayShift.custom(arr, 0, 4)
console.log(arr); // -> [2,3,4,5,1]

License

MIT