1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 14:54:22 +00:00
sophon/frontend/src/utils/ArrayExtension.ts

12 lines
320 B
TypeScript

export function arrayExtension<T>(array: Array<T>, index: number, newValue: T): Array<T> {
const clone = [...array]
clone[index] = newValue
return clone
}
export function arrayExclude<T>(array: Array<T>, index: number): Array<T> {
const clone = [...array]
clone.splice(index, 1)
return clone
}