Skip to content

resolveStreamSource

function resolveStreamSource<T>(source): StreamSourceInstance<T>;

Defined in: stream-source.ts:45

Resolve a stream source - calls the factory if it’s a function, otherwise returns the instance directly.

Type Parameter
T
Parameter Type
source StreamSource<T>

StreamSourceInstance<T>

function* gen() { yield 1; yield 2; }
// Works with factory
const source1 = resolveStreamSource(gen);
// Works with instance
const source2 = resolveStreamSource(gen());