Package: effect
Module: Array
Returns the index of the first element matching the predicate, wrapped in an
Option.
When to use
Use to find the index of the first matching element from the start of an iterable.
Example (Finding an index)
import { Array } from "effect"
console.log(Array.findFirstIndex([5, 3, 8, 9], (x) => x > 5)) // Option.some(2)
See
findLastIndex — search from the endfindFirst — get the element itselfSignature
declare const findFirstIndex: { <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option.Option<number>; <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option.Option<number>; }
Since v2.0.0