UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

22 lines 620 B
//#region src/array/removeOrThrow.d.ts /** * `removeOrThrow(target, value)` * * Removes the first occurrence of `value` from `target` array. If the value is not found, throws an error. * * ```ts * removeOrThrow([1, 2, 3, 2], 2); // [1, 3, 2] * removeOrThrow([1, 2, 3], 4); // throws FnError * ``` * * ```ts * pipe([1, 2, 3, 2], removeOrThrow(2)); // [1, 3, 2] * pipe([1, 2, 3], removeOrThrow(4)); // throws FnError * ``` */ declare const removeOrThrow: { <T>(value: NoInfer<T>): (target: readonly T[]) => T[]; <T>(target: readonly T[], value: NoInfer<T>): T[]; }; //#endregion export { removeOrThrow };