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 0.1.0 to 1.0.0

2

index.js
'use strict';
function arrayMove(x, from, to) {
x.splice(to, 0, x.splice(from, 1)[0]);
x.splice((to < 0 ? x.length + to : to), 0, x.splice(from, 1)[0]);
}

@@ -6,0 +6,0 @@

{
"name": "array-move",
"version": "0.1.0",
"version": "1.0.0",
"description": "Move an array item to a different position",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -18,7 +18,12 @@ # array-move [![Build Status](https://travis-ci.org/sindresorhus/array-move.svg?branch=master)](https://travis-ci.org/sindresorhus/array-move)

arrayMove(['a', 'b', 'c'], 1, 2);
var input = ['a', 'b', 'c'];
arrayMove(input, 1, 2);
//=> ['a', 'c', 'b']
arrayMove(['a', 'b', 'c'], -1, 0);
arrayMove(input, -1, 0);
//=> ['c', 'a', 'b']
arrayMove(input, -2, -3);
//=> ['b', 'a', 'c']
```

@@ -53,3 +58,4 @@

Index of where to move the item.
Index of where to move the item.
If negative, it will begin that many elements from the end.

@@ -56,0 +62,0 @@

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