itertools-ts
Version:
Extended itertools port for TypeScript and JavaScript. Provides a huge set of functions for working with iterable collections (including async ones)
185 lines (184 loc) • 8.53 kB
TypeScript
import { chunkwise, chunkwiseOverlap, compress, dropWhile, enumerate, filter, flatMap, flatten, groupBy, keys, limit, map, pairwise, repeat, skip, slice, sort, takeWhile, values, chunkwiseAsync, chunkwiseOverlapAsync, compressAsync, dropWhileAsync, enumerateAsync, filterAsync, flatMapAsync, flattenAsync, groupByAsync, keysAsync, limitAsync, mapAsync, pairwiseAsync, repeatAsync, skipAsync, sliceAsync, sortAsync, takeWhileAsync, valuesAsync } from "./single";
import { count, cycle, cycleAsync, repeat as infiniteRepeat } from "./infinite";
import { runningAverage, runningDifference, runningMax, runningMin, runningProduct, runningTotal, runningAverageAsync, runningDifferenceAsync, runningMaxAsync, runningMinAsync, runningProductAsync, runningTotalAsync } from "./math";
import { chain, zip, zipFilled, zipLongest, zipEqual, chainAsync, zipAsync, zipFilledAsync, zipLongestAsync, zipEqualAsync } from "./multi";
import { distinct, intersection, partialIntersection, symmetricDifference, union, cartesianProduct as cartesianProductDeprecated, distinctAsync, intersectionAsync, partialIntersectionAsync, symmetricDifferenceAsync, unionAsync, cartesianProductAsync as cartesianProductAsyncDeprecated } from "./set";
import { cartesianProduct, permutations, combinations, cartesianProductAsync, permutationsAsync, combinationsAsync } from "./combinatorics";
import { toAverage, toCount, toMax, toMin, toMinMax, toProduct, toRange, toSum, toValue, toFirst, toFirstAndLast, toLast, toAverageAsync, toCountAsync, toFirstAsync, toFirstAndLastAsync, toLastAsync, toMaxAsync, toMinAsync, toMinMaxAsync, toProductAsync, toRangeAsync, toSumAsync, toValueAsync } from "./reduce";
import { Stream } from "./stream";
import { AsyncStream } from "./async-stream";
import { allMatch, allUnique, anyMatch, exactlyN, isEmpty, isAsyncIterable, isIterable, isIterator, isReversed, isSorted, isString, noneMatch, same, sameCount, allMatchAsync, allUniqueAsync, anyMatchAsync, exactlyNAsync, isEmptyAsync, isReversedAsync, isSortedAsync, noneMatchAsync, sameAsync, sameCountAsync } from "./summary";
import { tee, toArray, toAsyncIterable, toAsyncIterator, toIterable, toIterator, toMap, toSet, teeAsync, toArrayAsync, toMapAsync, toSetAsync } from "./transform";
import { createPipe } from "./pipe";
import { InvalidArgumentError, LengthError } from "./exceptions";
import type { Numeric, NumericString, AsyncFlatMapper, FlatMapper, Pair, Comparable, Comparator, RecordKey, ZipTuple, PipeOperation, PipeOperationSequence, Pipe } from "./types";
export declare const single: {
chunkwise: typeof chunkwise;
chunkwiseOverlap: typeof chunkwiseOverlap;
compress: typeof compress;
dropWhile: typeof dropWhile;
enumerate: typeof enumerate;
filter: typeof filter;
flatMap: typeof flatMap;
flatten: typeof flatten;
groupBy: typeof groupBy;
keys: typeof keys;
limit: typeof limit;
map: typeof map;
pairwise: typeof pairwise;
repeat: typeof repeat;
skip: typeof skip;
slice: typeof slice;
sort: typeof sort;
takeWhile: typeof takeWhile;
values: typeof values;
chunkwiseAsync: typeof chunkwiseAsync;
chunkwiseOverlapAsync: typeof chunkwiseOverlapAsync;
compressAsync: typeof compressAsync;
dropWhileAsync: typeof dropWhileAsync;
enumerateAsync: typeof enumerateAsync;
filterAsync: typeof filterAsync;
flatMapAsync: typeof flatMapAsync;
flattenAsync: typeof flattenAsync;
groupByAsync: typeof groupByAsync;
keysAsync: typeof keysAsync;
limitAsync: typeof limitAsync;
mapAsync: typeof mapAsync;
pairwiseAsync: typeof pairwiseAsync;
repeatAsync: typeof repeatAsync;
skipAsync: typeof skipAsync;
sliceAsync: typeof sliceAsync;
sortAsync: typeof sortAsync;
takeWhileAsync: typeof takeWhileAsync;
valuesAsync: typeof valuesAsync;
};
export declare const infinite: {
count: typeof count;
cycle: typeof cycle;
cycleAsync: typeof cycleAsync;
repeat: typeof infiniteRepeat;
};
export declare const math: {
runningAverage: typeof runningAverage;
runningDifference: typeof runningDifference;
runningMax: typeof runningMax;
runningMin: typeof runningMin;
runningProduct: typeof runningProduct;
runningTotal: typeof runningTotal;
runningAverageAsync: typeof runningAverageAsync;
runningDifferenceAsync: typeof runningDifferenceAsync;
runningMaxAsync: typeof runningMaxAsync;
runningMinAsync: typeof runningMinAsync;
runningProductAsync: typeof runningProductAsync;
runningTotalAsync: typeof runningTotalAsync;
};
export declare const multi: {
chain: typeof chain;
zip: typeof zip;
zipFilled: typeof zipFilled;
zipLongest: typeof zipLongest;
zipEqual: typeof zipEqual;
chainAsync: typeof chainAsync;
zipAsync: typeof zipAsync;
zipFilledAsync: typeof zipFilledAsync;
zipLongestAsync: typeof zipLongestAsync;
zipEqualAsync: typeof zipEqualAsync;
};
export declare const set: {
distinct: typeof distinct;
intersection: typeof intersection;
partialIntersection: typeof partialIntersection;
symmetricDifference: typeof symmetricDifference;
union: typeof union;
distinctAsync: typeof distinctAsync;
intersectionAsync: typeof intersectionAsync;
partialIntersectionAsync: typeof partialIntersectionAsync;
symmetricDifferenceAsync: typeof symmetricDifferenceAsync;
unionAsync: typeof unionAsync;
/**
* @deprecated Use `combinatorics.cartesianProduct()` instead.
*/
cartesianProduct: typeof cartesianProductDeprecated;
/**
* @deprecated Use `combinatorics.cartesianProductAsync()` instead.
*/
cartesianProductAsync: typeof cartesianProductAsyncDeprecated;
};
export declare const combinatorics: {
cartesianProduct: typeof cartesianProduct;
permutations: typeof permutations;
combinations: typeof combinations;
cartesianProductAsync: typeof cartesianProductAsync;
permutationsAsync: typeof permutationsAsync;
combinationsAsync: typeof combinationsAsync;
};
export declare const reduce: {
toAverage: typeof toAverage;
toCount: typeof toCount;
toFirst: typeof toFirst;
toFirstAndLast: typeof toFirstAndLast;
toLast: typeof toLast;
toMax: typeof toMax;
toMin: typeof toMin;
toMinMax: typeof toMinMax;
toProduct: typeof toProduct;
toRange: typeof toRange;
toSum: typeof toSum;
toValue: typeof toValue;
toAverageAsync: typeof toAverageAsync;
toCountAsync: typeof toCountAsync;
toFirstAsync: typeof toFirstAsync;
toFirstAndLastAsync: typeof toFirstAndLastAsync;
toLastAsync: typeof toLastAsync;
toMaxAsync: typeof toMaxAsync;
toMinAsync: typeof toMinAsync;
toMinMaxAsync: typeof toMinMaxAsync;
toProductAsync: typeof toProductAsync;
toRangeAsync: typeof toRangeAsync;
toSumAsync: typeof toSumAsync;
toValueAsync: typeof toValueAsync;
};
export declare const summary: {
allMatch: typeof allMatch;
allUnique: typeof allUnique;
anyMatch: typeof anyMatch;
exactlyN: typeof exactlyN;
isEmpty: typeof isEmpty;
isAsyncIterable: typeof isAsyncIterable;
isIterable: typeof isIterable;
isIterator: typeof isIterator;
isReversed: typeof isReversed;
isSorted: typeof isSorted;
isString: typeof isString;
noneMatch: typeof noneMatch;
same: typeof same;
sameCount: typeof sameCount;
allMatchAsync: typeof allMatchAsync;
allUniqueAsync: typeof allUniqueAsync;
anyMatchAsync: typeof anyMatchAsync;
exactlyNAsync: typeof exactlyNAsync;
isEmptyAsync: typeof isEmptyAsync;
isReversedAsync: typeof isReversedAsync;
isSortedAsync: typeof isSortedAsync;
noneMatchAsync: typeof noneMatchAsync;
sameAsync: typeof sameAsync;
sameCountAsync: typeof sameCountAsync;
};
export declare const transform: {
tee: typeof tee;
toArray: typeof toArray;
toAsyncIterable: typeof toAsyncIterable;
toAsyncIterator: typeof toAsyncIterator;
toIterable: typeof toIterable;
toIterator: typeof toIterator;
toMap: typeof toMap;
toSet: typeof toSet;
teeAsync: typeof teeAsync;
toArrayAsync: typeof toArrayAsync;
toMapAsync: typeof toMapAsync;
toSetAsync: typeof toSetAsync;
};
export { Stream, AsyncStream };
export { createPipe };
export type { Numeric, NumericString, AsyncFlatMapper, FlatMapper, Pair, Comparable, Comparator, RecordKey, ZipTuple, PipeOperation, PipeOperationSequence, Pipe, };
export { InvalidArgumentError, LengthError };