@wopjs/tsur - v0.1.7
    Preparing search index...

    Function first

    • first finds the first item that matches a predicate. Returns the first item of array if no predicate is provided.

      Type Parameters

      • T

      Parameters

      • arr: T[]

        An array

      • predicate: (value: T, index: number, array: T[]) => boolean = truePredicate

        A predicate function.

      • OptionalthisArg: any

        If provided, it will be used as the this value for each invocation of predicate. If it is not provided, the first element is returned.

      Returns Option<T>

      The first item that matches the predicate, or None if no item matches.