@monstermann/fn
Version:
A utility library for TypeScript.
21 lines • 551 B
TypeScript
//#region src/array/removeAtOrThrow.d.ts
/**
* `removeAtOrThrow(target, idx)`
*
* Removes the element at index `idx` from `target` array. Supports negative indices to count from the end. If the index is out of bounds, throws an error.
*
* ```ts
* removeAtOrThrow([1, 2, 3], 1); // [1, 3]
* ```
*
* ```ts
* pipe([1, 2, 3], removeAtOrThrow(1)); // [1, 3]
* ```
*
*/
declare const removeAtOrThrow: {
<T>(idx: number): (target: readonly T[]) => T[];
<T>(target: readonly T[], idx: number): T[];
};
//#endregion
export { removeAtOrThrow };