UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

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