refactor: delete several events

This commit is contained in:
Carlos Valente
2024-05-24 11:38:54 +02:00
committed by Carlos Valente
parent 16f31a07b7
commit a09aa922bb
14 changed files with 84 additions and 35 deletions
@@ -34,6 +34,12 @@ export function deleteAtIndex<T>(index: number, array: T[]) {
return array.filter((_, i) => i !== index);
}
/**
* Reorders two objects in an array
* @param array
* @param fromIndex
* @param toIndex
*/
export function reorderArray<T>(array: T[], fromIndex: number, toIndex: number) {
if (fromIndex === toIndex) {
return array; // No change needed, return the original array