shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
moveItem
Type:Function
Status:stable
Platform:jsnode
@blackbyte.sugar.shared.array
This function allows you to move an item to another place in the array
Params
- array*-Array
The array to process
- from*-any|integer
Either the element itself that you want to move, or the index of the element you want to move
- to*-any|integer
Either the element itself where you want to move the first one, or the index of the element you want to move your element to
Return
- -Array
The processed array
Example
import { moveItem } from '@blackbyte/sugar/array';
const myArray = ['hello','world','something'];
moveItem(myArray, 0, 1); // ['world','hello','something']Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space