Function
Static Public Summary | ||
public |
Converts a tape of tapes of tokens to a tape of tokens. |
|
public |
Exhausts a tape. |
|
public |
fromAsyncIterable(_iterable: AsyncIterable): Tape Converts an asynchronous iterable to a tape. |
|
public |
fromCallable(callable: Function): Tape Converts a callable to a tape. |
|
public |
fromIterable(iterable: Iterable): Tape Converts an iterable to a tape. |
|
public |
fromIterator(iterator: Iterator | AsyncIterator): Tape Converts an iterator to a tape. |
|
public |
fromReadStream(readStream: ReadStream): Tape Converts a ReadStream object to a tape. |
|
public |
Filters a tape by ignoring a given set of tokens. |
|
public |
Applies a callable to each token of a tape. |
|
public |
Splits the input tape into a tape of tapes according to some set of separators. |
|
public |
Converts a tape to an array. |
|
public |
toAsyncCallable(tape: Tape): Function Converts a tape to a callable. |
|
public |
async * toAsyncIterable(tape: Tape): AsyncIterable Converts a tape to an asynchronous iterable. |
|
public |
toAsyncIterator(tape: Tape): AsyncIterator Converts a tape to an async iterator. |
|
public |
Converts a tape to a string. |
Static Private Summary | ||
private |
_fromReadStream(readStream: ReadStream): AsyncIterable Converts a ReadStream object to an async iterable of tokens. |
|
private |
async * _fromReadStreamIterator(iterator: AsyncIterator): AsyncIterable Converts a ReadStream iterator to an async iterable of tokens. |
|
private |
Same as split, but returns an iterable rather than a tape. |
|
private |
asyncIterableChain(iterables: AsyncIterable<AsyncIterable>): AsyncIterable Utility function to chain an async iterable of async iterables. |
|
private |
asyncIterableMap(callable: Function, iterable: AsyncIterable): AsyncIterable Utility function to apply a sync callable to each item of an async iterable. |
|
private |
async * asyncIteratorMap(callable: Function, iterator: AsyncIterator): AsyncIterator Utility function to apply a sync callable to each item of an async iterator. |
|
private |
Outputs the next token of a tape that is not contained in a given toskip set. |
Static Public
public chain(tape: Tape): Tape source
import chain from '@async-abstraction/tape/src/chain.js'
Converts a tape of tapes of tokens to a tape of tokens.
Params:
Name | Type | Attribute | Description |
tape | Tape | The tape of tapes of tokens to read from. |
public async exhaust(tape: Tape) source
import exhaust from '@async-abstraction/tape/src/exhaust.js'
Exhausts a tape.
Params:
Name | Type | Attribute | Description |
tape | Tape | The tape to read from. |
public fromAsyncIterable(_iterable: AsyncIterable): Tape source
import fromAsyncIterable from '@async-abstraction/tape/src/fromAsyncIterable.js'
Converts an asynchronous iterable to a tape.
Params:
Name | Type | Attribute | Description |
_iterable | AsyncIterable | The iterable to convert. |
public fromCallable(callable: Function): Tape source
import fromCallable from '@async-abstraction/tape/src/fromCallable.js'
Converts a callable to a tape.
Params:
Name | Type | Attribute | Description |
callable | Function | The callable to convert. |
public fromIterable(iterable: Iterable): Tape source
import fromIterable from '@async-abstraction/tape/src/fromIterable.js'
Converts an iterable to a tape.
Params:
Name | Type | Attribute | Description |
iterable | Iterable | The iterable to convert. |
public fromIterator(iterator: Iterator | AsyncIterator): Tape source
import fromIterator from '@async-abstraction/tape/src/fromIterator.js'
Converts an iterator to a tape.
Params:
Name | Type | Attribute | Description |
iterator | Iterator | AsyncIterator | The iterator to convert. |
public fromReadStream(readStream: ReadStream): Tape source
import fromReadStream from '@async-abstraction/tape/src/fromReadStream.js'
Converts a ReadStream object to a tape.
Params:
Name | Type | Attribute | Description |
readStream | ReadStream | The ReadStream object to convert. |
public ignore(tape: Tape, toignore: Iterable): Tape source
import ignore from '@async-abstraction/tape/src/ignore.js'
Filters a tape by ignoring a given set of tokens.
Params:
Name | Type | Attribute | Description |
tape | Tape | The tape to filter. |
|
toignore | Iterable | The tokens to ignore. |
public map(callable: Function, tape: Tape): Tape source
import map from '@async-abstraction/tape/src/map.js'
Applies a callable to each token of a tape.
public split(tape: Tape, sep: Iterable): Tape source
import split from '@async-abstraction/tape/src/split.js'
Splits the input tape into a tape of tapes according to some set of separators. See _split for the actual implementation.
Params:
Name | Type | Attribute | Description |
tape | Tape | The input tape. |
|
sep | Iterable | An iterable of separators. |
public toArray(tape: Tape): Promise<any[]> source
import toArray from '@async-abstraction/tape/src/toArray.js'
Converts a tape to an array.
Params:
Name | Type | Attribute | Description |
tape | Tape | The tape to read from. |
public toAsyncCallable(tape: Tape): Function source
import toAsyncCallable from '@async-abstraction/tape/src/toAsyncCallable.js'
Converts a tape to a callable.
Params:
Name | Type | Attribute | Description |
tape | Tape | The tape to read from. |
public async * toAsyncIterable(tape: Tape): AsyncIterable source
import toAsyncIterable from '@async-abstraction/tape/src/toAsyncIterable.js'
Converts a tape to an asynchronous iterable.
Params:
Name | Type | Attribute | Description |
tape | Tape | The tape to read from. |
Return:
AsyncIterable | The converted iterable. |
public toAsyncIterator(tape: Tape): AsyncIterator source
import toAsyncIterator from '@async-abstraction/tape/src/toAsyncIterator.js'
Converts a tape to an async iterator.
Params:
Name | Type | Attribute | Description |
tape | Tape | The tape to read from. |
Return:
AsyncIterator | The converted iterator. |
public toString(tape: Tape): Promise<string> source
import toString from '@async-abstraction/tape/src/toString.js'
Converts a tape to a string.
Params:
Name | Type | Attribute | Description |
tape | Tape | The tape to read from. |
Static Private
private _fromReadStream(readStream: ReadStream): AsyncIterable source
import {_fromReadStream} from '@async-abstraction/tape/src/fromReadStream.js'
Converts a ReadStream object to an async iterable of tokens.
Params:
Name | Type | Attribute | Description |
readStream | ReadStream | The ReadStream object to convert. |
Return:
AsyncIterable | The converted iterable. |
private async * _fromReadStreamIterator(iterator: AsyncIterator): AsyncIterable source
import {_fromReadStreamIterator} from '@async-abstraction/tape/src/fromReadStream.js'
Converts a ReadStream iterator to an async iterable of tokens.
Params:
Name | Type | Attribute | Description |
iterator | AsyncIterator | The ReadStream iterator to convert. |
Return:
AsyncIterable | The converted iterable. |
private _split(tape: Tape, sep: Iterable): AsyncIterableIterator source
import {_split} from '@async-abstraction/tape/src/split.js'
Same as split, but returns an iterable rather than a tape.
Params:
Name | Type | Attribute | Description |
tape | Tape | The input tape. |
|
sep | Iterable | An iterable of separators. |
Return:
AsyncIterableIterator | An iterable of tapes. |
private asyncIterableChain(iterables: AsyncIterable<AsyncIterable>): AsyncIterable source
import asyncIterableChain from '@async-abstraction/tape/src/asyncIterableChain.js'
Utility function to chain an async iterable of async iterables.
Params:
Name | Type | Attribute | Description |
iterables | AsyncIterable<AsyncIterable> | the input iterable of iterables. |
Return:
AsyncIterable | The chain of the input iterables. |
private asyncIterableMap(callable: Function, iterable: AsyncIterable): AsyncIterable source
import asyncIterableMap from '@async-abstraction/tape/src/asyncIterableMap.js'
Utility function to apply a sync callable to each item of an async iterable.
Params:
Name | Type | Attribute | Description |
callable | Function | The callable to apply. |
|
iterable | AsyncIterable | The iterable to process. |
Return:
AsyncIterable | The iterable of mapped values. |
private async * asyncIteratorMap(callable: Function, iterator: AsyncIterator): AsyncIterator source
import asyncIteratorMap from '@async-abstraction/tape/src/asyncIteratorMap.js'
Utility function to apply a sync callable to each item of an async iterator.
Params:
Name | Type | Attribute | Description |
callable | Function | The callable to apply. |
|
iterator | AsyncIterator | The iterator to process. |
Return:
AsyncIterator | The iterator of mapped values. |
private async skip(tape: Tape, toskip: Iterable): Promise source
import skip from '@async-abstraction/tape/src/skip.js'
Outputs the next token of a tape that is not contained in a given toskip set.
Params:
Name | Type | Attribute | Description |
tape | Tape | The input tape. |
|
toskip | Iterable | The (hashable) tokens to skip. |