mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 13:38:22 +00:00
6 lines
181 B
TypeScript
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
|
|
}
|