lastIndexOfOr
ts
function Array.lastIndexOfOr<T, U>(
target: readonly T[],
value: NoInfer<T>,
or: U,
): number | UReturns the index of the last occurrence of value in target. If value is not found, returns or.
Example
ts
import { Array } from "@monstermann/array";
Array.lastIndexOfOr([1, 2, 3, 2], 2, -1); // 3
Array.lastIndexOfOr([1, 2, 3], 4, -1); // -1ts
import { Array } from "@monstermann/array";
pipe([1, 2, 3, 2], Array.lastIndexOfOr(2, -1)); // 3
pipe([1, 2, 3], Array.lastIndexOfOr(4, -1)); // -1