mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-18 23:17:59 +01:00
11 lines
380 B
TypeScript
11 lines
380 B
TypeScript
|
// http://stackoverflow.com/a/5306832/1726690
|
||
|
export function moveElement<Items>(array: Items[], from: number, to: number): void {
|
||
|
array.splice(to, 0, array.splice(from, 1)[0]);
|
||
|
}
|
||
|
|
||
|
export function arraysEqual(array1: unknown[], array2: unknown[]): boolean {
|
||
|
if (array1.length !== array2.length) return false;
|
||
|
|
||
|
return array1.every((item, index) => item === array2[index]);
|
||
|
}
|