Skip to content

benrei/array-shift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Shift array element up, down or custom

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published