New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

array-move

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-move - npm Package Compare versions

Comparing version 2.2.2 to 3.0.0

3

index.d.ts

@@ -39,7 +39,4 @@ declare const arrayMove: {

mutate(array: unknown[], from: number, to: number): void;
// TODO: Remove this for the next major release
default: typeof arrayMove;
};
export = arrayMove;

12

index.js

@@ -5,8 +5,11 @@ 'use strict';

const startIndex = to < 0 ? array.length + to : to;
const item = array.splice(from, 1)[0];
array.splice(startIndex, 0, item);
if (startIndex >= 0 && startIndex < array.length) {
const item = array.splice(from, 1)[0];
array.splice(startIndex, 0, item);
}
};
const arrayMove = (array, from, to) => {
array = array.slice();
array = [...array];
arrayMoveMutate(array, from, to);

@@ -17,5 +20,2 @@ return array;

module.exports = arrayMove;
// TODO: Remove this for the next major release
module.exports.default = arrayMove;
module.exports.mutate = arrayMoveMutate;
{
"name": "array-move",
"version": "2.2.2",
"version": "3.0.0",
"description": "Move an array item to a different position",

@@ -14,3 +14,3 @@ "license": "MIT",

"engines": {
"node": ">=8"
"node": ">=10"
},

@@ -17,0 +17,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc