Skip to content

function that given a movement configuration Map and an array, it creates a new array with reordered positions

Notifications You must be signed in to change notification settings

xgbuils/rearrange

Repository files navigation

rearrange

travis ci npm version Coverage Status Dependency Status

Function that given a movement configuration Map and an array, it creates a new array with rearranged positions.

Install

npm install rearrange --save

Usage

const rearrange = require('rearrange')

rearrange(new Map([
    [1, 5], // item in position 1 moved to position 5
    [6, 2]  // item in position 6 moved to position 2
]), ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']) // ['a', 'c', 'g', 'd', 'e', 'b', 'f', 'h', 'i']

Support

  • Node.js >=6

License

MIT

About

function that given a movement configuration Map and an array, it creates a new array with reordered positions

Resources

Stars

Watchers

Forks

Packages

No packages published