array-move
Advanced tools
Comparing version 3.0.0 to 3.0.1
'use strict'; | ||
const arrayMoveMutate = (array, from, to) => { | ||
const startIndex = to < 0 ? array.length + to : to; | ||
const startIndex = from < 0 ? array.length + from : from; | ||
if (startIndex >= 0 && startIndex < array.length) { | ||
const item = array.splice(from, 1)[0]; | ||
array.splice(startIndex, 0, item); | ||
const endIndex = to < 0 ? array.length + to : to; | ||
const [item] = array.splice(from, 1); | ||
array.splice(endIndex, 0, item); | ||
} | ||
@@ -10,0 +12,0 @@ }; |
{ | ||
"name": "array-move", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Move an array item to a different position", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
4814
48