@szilanor/stream
    Preparing search index...

    Variable findIndexConst

    findIndex: <T>(predicate?: PredicateFunction<T>) => CollectorFunction<T, number> = firstIndex

    Type declaration

      • <T>(predicate?: PredicateFunction<T>): CollectorFunction<T, number>
      • Returns the index of the first element in the source that satisfies the predicate.

        Type Parameters

        • T

          Type of items in the source.

        Parameters

        • predicate: PredicateFunction<T> = ...

          Predicate function to determine if an element should be returned.

        Returns CollectorFunction<T, number>

        Collector that returns the index of the first element in the source that satisfies the predicate.

        const result = firstIndex<number>((x) => x > 1)([1, 2, 3]);
        console.log(result); // 1