@szilanor/stream
    Preparing search index...

    Function defer

    • Returns a Stream that defers the creation of the Iterable until the Stream is iterated.

      Type Parameters

      • T

        Type of items in the Iterable.

      Parameters

      • factory: () => Iterable<T>

        Factory function that returns an Iterable.

      Returns Stream<T>

      Stream that defers the creation of the Iterable.

      const result = defer(() => 'ABCD');
      console.log([...result]); // ['A', 'B', 'C', 'D']