refactoring: TypeScript migration, security fixes,

This commit is contained in:
Maurice
2026-03-27 18:40:18 +01:00
parent 510475a46f
commit 8396a75223
150 changed files with 8116 additions and 8467 deletions
+12
View File
@@ -0,0 +1,12 @@
interface ItemWithId {
id: number
[key: string]: unknown
}
export function swapItems(items: ItemWithId[], index: number, direction: 'up' | 'down'): number[] | null {
const target = direction === 'up' ? index - 1 : index + 1
if (target < 0 || target >= items.length) return null
const ids = items.map((a) => a.id)
;[ids[index], ids[target]] = [ids[target], ids[index]]
return ids
}