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.
pred
The match condition of element to find.
The found position if exists.
const list = fromArray([1, 4, 2, 3, 5]);expect(findIndex((x: number) => 4 <= x)(list)).toStrictEqual(Option.some(1));expect(findIndex((x: number) => 0 <= x)(list)).toStrictEqual(Option.some(0));expect(findIndex((x: number) => 8 <= x)(list)).toStrictEqual(Option.none()); Copy
const list = fromArray([1, 4, 2, 3, 5]);expect(findIndex((x: number) => 4 <= x)(list)).toStrictEqual(Option.some(1));expect(findIndex((x: number) => 0 <= x)(list)).toStrictEqual(Option.some(0));expect(findIndex((x: number) => 8 <= x)(list)).toStrictEqual(Option.none());
Finds the position of element which satisfies
predin the list. If the list is infinite and the element is not found, this will hang forever.