It moves an array element from one index position to another.
✅
Immutable: This does not mutate the given array.
Syntax
import { move } from '@opentf/std';
move(arr: T[], from: number, to: number): T[];
Usage
import { move } from "@opentf/std";
move([], 0, 1);
Examples
move([1, 2, 3], 0, 2); //=> [2, 3, 1]
move([1, 2, 3], 0, 5); //=> [2, 3, 1]
move([1, 2, 3], 5, 0); //=> [1, 2, 3]