removeOrThrow
Array.removeOrThrow(target, value)
Removes the first occurrence of value from target array. If the value is not found, throws an error.
Example
ts
import { Array } from "@monstermann/array";
Array.removeOrThrow([1, 2, 3, 2], 2); // [1, 3, 2]
Array.removeOrThrow([1, 2, 3], 4); // throws FnErrorts
import { Array } from "@monstermann/array";
pipe([1, 2, 3, 2], Array.removeOrThrow(2)); // [1, 3, 2]
pipe([1, 2, 3], Array.removeOrThrow(4)); // throws FnError