Package Exports
- extra-generator
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (extra-generator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
extra-generator
Install
npm install --save extra-generator
# or
yarn add extra-generator
API
of
function of<T>(val: T): Iterable<T>
of(1) // [1]
repeat
function repeat<T>(val: T, times: number = Infinity): Iterable<T>
repeat(1) // [1, 1, 1, ...]
repeat(1, 3) // [1, 1, 1]
repeat(1, 0) // []
countdown
function countdown(begin: number, end: number): Iterable<number>
countdown(2, -2) // [2, 1, 0, -1, -2]
countdown(1, 1) // [1]
countdown(0, 1) // []
countup
function countup(begin: number, end: number): Iterable<number>
countup(-2, 2) // [-2, -1, 0, 1, 2]
countup(1, 1) // [1]
countup(1, 0) // []
range
function range(start: number, end: number, step: number = 1): Iterable<number>
// assert(step > 0)
range(1, 1) // []
range(-2, 2) // [-2, -1, 0, 1]
range(2, -2) // [2, 1, 0, -1]
range(1, -1, 0.5) // [1, 0.5, 0, -0.5]
range(2, -2, 0) // throw Error
range(2, -2, -0.5) // throw Error
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
interface IMessage {
event?: string
data: string
id?: string
retry?: number
}
function sse(message: IMessage): Iterable<string>