Package Exports
- aitertools
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 (aitertools) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
aitertools
This library provides a well-tested collection of small utility functions dealing with async iterables. You can think of it as .NET LINQ or Python aitertools for Deno & Node.js.
Functions
For the complete list of functions, see the complete API reference.
concat(...sources): Concatenate multiple async iterables into one.take(source, count): Take the firstcountitems from thesource.drop(source, count): Drop the firstcountitems from thesource.takeWhile(source, predicate): Take items from thesourcewhile thepredicatereturnstrue.dropWhile(source, predicate): Drop items from thesourcewhile thepredicatereturnstrue.takeEnd(source, count): Take the lastcountitems from thesource.dropEnd(source, count): Drop the lastcountitems from thesource.map(mapper, ...sources): Apply themapperto each item in thesources.filter(predicate, ...sources): Filter items in thesourcesby thepredicate.reduce(reducer, source, initial?): Reduce thesourceto a single value by thereducer, optionally with theinitialvalue.tee(source, numbeer): Effectively duplicate thesourceintonumberof async iterables.groupBy(source, keySelector): Group items in thesourceby thekeySelector.unique(source, keySelector?): Eliminate duplicate items in thesource, optionally by thekeySelector.range(start?, stop, step?): Generate a sequence of numbers fromstarttostopbystep.count(start?, step?): Generate a sequence of numbers fromstartbystepinfinitely.cycle(source): Cycle thesourceinfinitely.repeat(value, times?): Repeat thevaluefortimestimes, or infinitely iftimesis not specified.fromIterable(source): Convert an iterable to an async iterable.toArray(source): Convert an async iterable to an array.toSet(source): Convert an async iterable to aSet.toMap(source, keySelector, valueSelector?): Convert an async iterable to aMap.assertStreams(actual, expected, msg?): Asset that an async iterableactualis equal to an arrayexpected.assertStreamStartsWith(actual, expected, msg?): Asset that an async iterableactual(which is possibly infinite) starts with an arrayexpected.
Usage
In Deno:
import * as aitertools from "https://deno.land/x/aitertools/mod.ts";In Node.js:
$ npm add aitertoolsimport * as aitertools from "aitertools";Changelog
See CHANGES.md file. Note that unreleased versions are also available on nest.land for Deno:
import * as aitertools
from "https://x.nest.land/aitertools@0.4.0-dev.15+3f191d7/mod.ts";… and on npm with dev tag for Node.js:
$ npm add aitertools@dev