1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-23 15:24:21 +00:00
sophon/frontend/src/utils/ArrayExtension.ts
Stefano Pigozzi 0d5ac18fcf 💥 Make progress towards the new "Context" structure
This commit is the result of multiple squashed non-atomic commits.
2021-10-06 04:38:19 +02:00

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