@monstermann/fn
Version:
A utility library for TypeScript.
22 lines • 637 B
TypeScript
//#region src/array/removeAt.d.ts
/**
* `removeAt(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, returns the original array unchanged.
*
* ```ts
* removeAt([1, 2, 3, 4], 1); // [1, 3, 4]
* ```
*
* ```ts
* pipe([1, 2, 3, 4], removeAt(1)); // [1, 3, 4]
* ```
*/
declare const removeAt: {
(idx: number): <T>(target: T[]) => T[];
(idx: number): <T>(target: readonly T[]) => readonly T[];
<T>(target: T[], idx: number): T[];
<T>(target: readonly T[], idx: number): readonly T[];
};
//#endregion
export { removeAt };