Files
shumai/packages/webui/lib/dnd-utils.ts
T

6 lines
181 B
TypeScript

export function arrayMove<T>(array: T[], from: number, to: number): T[] {
const newArray = array.slice()
newArray.splice(to, 0, newArray.splice(from, 1)[0])
return newArray
}