Huge News!Announcing our $40M Series B led by Abstract Ventures.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

Move an array item to a different position

  • 2.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
234K
increased by1.24%
Maintainers
1
Weekly downloads
 
Created

What is array-move?

The `array-move` npm package allows you to move an item in an array from one position to another. This can be useful for reordering lists or managing the positions of elements in an array.

What are array-move's main functionalities?

Move an item within an array

This feature allows you to move an item from one index to another within the same array. In this example, the item at index 1 ('b') is moved to index 2.

const arrayMove = require('array-move');
const input = ['a', 'b', 'c'];
const result = arrayMove(input, 1, 2);
console.log(result); // ['a', 'c', 'b']

Move an item to the start of an array

This feature allows you to move an item to the start of the array. In this example, the item at index 2 ('c') is moved to index 0.

const arrayMove = require('array-move');
const input = ['a', 'b', 'c'];
const result = arrayMove(input, 2, 0);
console.log(result); // ['c', 'a', 'b']

Move an item to the end of an array

This feature allows you to move an item to the end of the array. In this example, the item at index 0 ('a') is moved to index 2.

const arrayMove = require('array-move');
const input = ['a', 'b', 'c'];
const result = arrayMove(input, 0, 2);
console.log(result); // ['b', 'c', 'a']

Other packages similar to array-move

Keywords

FAQs

Package last updated on 01 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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