Files
sentinel/static/app/utils/removeAtArrayIndex.tsx
2024-02-15 17:01:50 +00:00

9 lines
223 B
TypeScript

/**
* Remove item at `index` in `array` without mutating `array`
*/
export function removeAtArrayIndex<T>(array: T[], index: number): T[] {
const newArray = [...array];
newArray.splice(index, 1);
return newArray;
}