arrayMove.ts 165 B

1234
  1. export const arrayMove = <T>(array: T[], fromIndex: number, toIndex: number): T[] => {
  2. array.splice(toIndex, 0, array.splice(fromIndex, 1)[0]);
  3. return array;
  4. };