The match condition of element to find.
The found position if exists.
import { findIndex, fromArray } from "./list.ts";
import * as Option from "./option.ts";
import { assertEquals } from "../deps.ts";
const list = fromArray([1, 4, 2, 3, 5]);
assertEquals(findIndex((x: number) => 4 <= x)(list), Option.some(1));
assertEquals(findIndex((x: number) => 0 <= x)(list), Option.some(0));
assertEquals(findIndex((x: number) => 8 <= x)(list), Option.none());
Generated using TypeDoc
Finds the position of element which satisfies
pred
in the list. If the list is infinite and the element is not found, this will hang forever.