@szilanor/stream
    Preparing search index...

    Variable findOrDefaultAsyncConst

    findOrDefaultAsync: <T>(
        defaultValue: ValueOrFactory<T>,
        predicate?: MaybeAsyncPredicateFunction<T>,
    ) => AsyncCollectorFunction<T, T> = firstOrDefaultAsync

    Type Declaration

      • <T>(
            defaultValue: ValueOrFactory<T>,
            predicate?: MaybeAsyncPredicateFunction<T>,
        ): AsyncCollectorFunction<T, T>
      • Returns a collector that returns the first entry from the Iterable that satisfies the 'predicate' function or the 'defaultValue'.

        Type Parameters

        • T

          Type of items in the source.

        Parameters

        Returns AsyncCollectorFunction<T, T>

        Collector that returns the first entry from the Iterable that satisfies the 'predicate' function or the 'defaultValue'.

        const result = firstOrDefaultAsync(2)([1, 2, 3]);
        console.log(result); // 2