UNPKG

carbon-react

Version:

A library of reusable React components for easily building user interfaces.

16 lines (15 loc) 428 B
/** * Move an array element from one position to another, without mutating the original array. * * ```ts * const array = ["a", "b", "c", "d"]; * const result = arrayMove({ array, startIndex: 1, endIndex: 3 }); * // result is ["a", "c", "d", "b"] * ``` * */ declare function arrayMove<T>({ array, startIndex, endIndex, }: { array: T[]; startIndex: number; endIndex: number; }): T[]; export default arrayMove;