mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
9 lines
224 B
TypeScript
9 lines
224 B
TypeScript
/**
|
|
* Replace item at `index` in `array` with `obj`
|
|
*/
|
|
export function replaceAtArrayIndex<T>(array: T[], index: number, obj: T): T[] {
|
|
const newArray = [...array];
|
|
newArray.splice(index, 1, obj);
|
|
return newArray;
|
|
}
|