Skip to content

remove

ts
function Array.remove<T>(
    target: readonly T[],
    value: NoInfer<T>,
): readonly T[]

Removes the first occurrence of value from target array. If the value is not found, returns the original array unchanged.

Example

ts
import { Array } from "@monstermann/array";

Array.remove([1, 2, 3, 2], 2); // [1, 3, 2]
ts
import { Array } from "@monstermann/array";

pipe([1, 2, 3, 2], Array.remove(2)); // [1, 3, 2]