array-move-item
Move an array item to a different position within array bounds
Install
$ npm install --save array-move-item
API
moveItem(array, fromIndex, toIndex)
Returns a new array with the item moved to the new position.
If the target index is greater than the length of the array, the item is moved to the end of the array.
If the target index is negative and greater than the length of the array, the item is moved to the start of the array.
Usage
var moveItem = ; const items = 'a' 'b' 'c'; ;//=> ['a', 'c', 'b'] ;//=> ['c', 'a', 'b'] ;//=> ['b', 'a', 'c']
License
MIT © Illarion Koperski