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 Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
source |
StreamSource<T> |
Returns
Section titled “Returns”Example
Section titled “Example”function* gen() { yield 1; yield 2; }
// Works with factoryconst source1 = resolveStreamSource(gen);// Works with instanceconst source2 = resolveStreamSource(gen());