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

13 lines
317 B
TypeScript
Raw Normal View History

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]
delete clone[index]
return clone
}