array-move
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -12,3 +12,3 @@ declare const arrayMove: { | ||
``` | ||
import arrayMove from 'array-move'; | ||
import arrayMove = require('array-move'); | ||
@@ -37,4 +37,7 @@ const input = ['a', 'b', 'c']; | ||
mutate(array: unknown[], from: number, to: number): void; | ||
// TODO: Remove this for the next major release | ||
default: typeof arrayMove; | ||
}; | ||
export default arrayMove; | ||
export = arrayMove; |
'use strict'; | ||
const arrayMoveMutate = (array, from, to) => { | ||
array.splice((to < 0 ? array.length + to : to), 0, array.splice(from, 1)[0]); | ||
array.splice(to < 0 ? array.length + to : to, 0, array.splice(from, 1)[0]); | ||
}; | ||
@@ -14,4 +14,5 @@ | ||
module.exports = arrayMove; | ||
// TODO: Remove this for the next major release | ||
module.exports.default = arrayMove; | ||
module.exports.mutate = arrayMoveMutate; |
{ | ||
"name": "array-move", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Move an array item to a different position", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"scripts": { | ||
"test": "xo && ava && tsd-check" | ||
"test": "xo && ava && tsd" | ||
}, | ||
@@ -31,6 +31,6 @@ "files": [ | ||
"devDependencies": { | ||
"ava": "^1.3.1", | ||
"tsd-check": "^0.6.0", | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.1", | ||
"xo": "^0.24.0" | ||
} | ||
} |
4383
44