export function move(arr: T[], from: number, to: number): T[] { if ( from === to || from < 0 || to < 0 || from >= arr.length || to >= arr.length ) { return arr } const next = arr.slice() const [sp] = next.splice(from, 1) next.splice(to, 0, sp) return next }