Skip to content

granteagon/move

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

_.move LoDash mixin

Move an item in an array

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

Usage

  • Install the package via NPM
npm install lodash-move

or via Yarn

yarn add lodash-move
  • Import it into your project:
// Node.JS
const move = require('lodash-move')

// ES6+
import move from 'lodash-move'
  • Use it!

Syntax

move(array, fromIndex, toIndex)

Example

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

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

About

Move lodash mixin. Move an item in array.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published