Install
npm install --save extra-generator
yarn add extra-generator
API
of
function of<T>(val: T): Iterable<T>
of(1)
countdown
function countdown(begin: number, end: number): Iterable<number>
countdown(2, -2)
countdown(1, 1)
countdown(0, 1)
countup
function countup(begin: number, end: number): Iterable<number>
countup(-2, 2)
countup(1, 1)
countup(1, 0)
range
function range(start: number, end: number, step: number = 1): Iterable<number>
range(1, 1)
range(-2, 2)
range(2, -2)
range(1, -1, 0.5)
range(2, -2, 0)
range(2, -2, -0.5)
stringifyJSONStream
function stringifyJSONStream(iterable: Iterable<unknown>): Iterable<string>
stringifyJSONStreamAsync
function stringifyNDJSONStreamAsync(iterable: AsyncIterable<unknown>): AsyncIterable<string>
stringifyNDJSONStream
function stringifyNDJSONStream(iterable: Iterable<unknown>): Iterable<string>
stringifyNDJSONStreamAsync
function stringifyNDJSONStreamAsync(iterable: AsyncIterable<unknown>): AsyncIterable<string>
sse
function sse(text: string): Iterable<string>
Split text to Server-Sent Event lines.