@szilanor/stream
    Preparing search index...

    Function defaultIfEmptyAsync

    • Returns an AsyncOperationFunction that yields the defaultValue parameter if the source Iterable is empty.

      Type Parameters

      • T

        The type of the elements in the source Iterable.

      Parameters

      • defaultValue: ValueOrFactory<T>

        The value or factory to use when the source Iterable is empty.

      Returns AsyncOperationFunction<T, T>

      An AsyncOperationFunction that yields the defaultValue parameter if the source Iterable is empty.

      const result = defaultIfEmptyAsync<number>([], 0);
      console.log(result); // [0]