The type of values contributed to the feed
const array: Data<number> = [1, 2, 3];
const iterable: Data<number> = new Set([1, 2, 3]);
const asynchronous: Data<number> = (async function* () { yield 1; yield 2; })();
const feed: Data<number> = items(1, 2, 3);
items to contribute values as they are, without shape inspection
Data accepted wherever a feed is opened or extended.
Callers supply data in whichever shape is most convenient, each contributing items to the feed as follows:
readonly V[]— contributes the items of the arrayIterable<V>— contributes the items of the iterable, strings excepted, as they are treated as atomic values and contributed whole rather than character by characterAsyncIterable<V>— contributes the items of the async iterable<V>— contributes the items of the feedEvery shape is a batch of items rather than a single value: a lone value is contributed by wrapping it in an array and an empty batch contributes nothing. Feeds of arrays stay expressible, as
readonly V[]always denotes the batch rather than one of the values carried by it.Optional values need not be filtered out beforehand: every shape accepts
undefinedentries and drops them as data enters a feed, so a source ofundefined | Vvalues opens a feed carryingVitems.The feed function opens a new feed from this shape; flatMap accepts it to expand each item already carried into further ones.