Move an array element to a given position.
npm install --save --save-exact move-element
const moveElement = require('move-element')
// Say you have an array of fruits
const fruits = ['Oranges', 'Apples', 'Bananas', 'Pineapples']
// And you want to swap the positions of 'Apples' and 'Bananas'
// First you make a function that returns true for the element you want to move
const isApples = (x) => x === 'Apples'
// Then you call moveElement with the index you want to move the element to
const newArray = moveElement(fruits, isApple, 2)
// Then newArray will be set to:
// ['Oranges', 'Bananas', 'Apples', 'Pineapples']