Returns an array with an item moved to a new position.
export function moveItem<T>(
arr: T[],
currentIndex: number,
newIndex: number,
): T[]
// Example:
const arr = [0, 1, 2, 3, 4, 5]
moveItem(arr, 3, 1) //=> [0, 3, 1, 2, 4, 5]
Returns an array with an item moved to a new position.
export function moveItem<T>(
arr: T[],
currentIndex: number,
newIndex: number,
): T[]
// Example:
const arr = [0, 1, 2, 3, 4, 5]
moveItem(arr, 3, 1) //=> [0, 3, 1, 2, 4, 5]