Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including lodash-move with all npm packages installed. Try it out:

var lodashMove = require("lodash-move")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

lodash-move v1.1.1

Move an item in an array (proposed lodash feature #1701)

_.move LoDash mixin

Move an item in an array

npm install lodash-move

LoDash issue is here. Give it a 👍 if you want to see it added to Lodash.

Example

move(['a', 'b', 'c'], 2, 0)
// -> ['c', 'a', 'b']

move([{name: 'Fred'}, {name: 'Barney'}, {name: 'Wilma'}, {name: 'Betty'}], 2, 1)
// -> [{name: 'Fred', name: 'Wilman', name: 'Barney', name: 'Betty'}]

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free