From 1f8870fe092bb4f48987aeee4cc8048d2e725fc1 Mon Sep 17 00:00:00 2001 From: Paul Taylor Date: Mon, 14 Jan 2019 13:34:04 -0800 Subject: [PATCH] Import all add/* operators, fix scanProto typings (#262) * fix(exports): export all iterable and asynciterable operators * fix(asynciterable#scanProto): allow AsyncIterable#scan selector to return R | Promise --- src/Ix.ts | 54 ++++++++++++++++--------- src/add/asynciterable-operators/scan.ts | 6 +-- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/src/Ix.ts b/src/Ix.ts index 091eaaa2..6fd1593c 100644 --- a/src/Ix.ts +++ b/src/Ix.ts @@ -33,6 +33,12 @@ import './add/iterable/create'; import './add/iterable/defer'; import './add/iterable/empty'; import './add/iterable/for'; +import './add/iterable/generate'; +import './add/iterable/if'; +import './add/iterable/ofentries'; +import './add/iterable/ofkeys'; +import './add/iterable/ofvalues'; +import './add/iterable/onerrorresumenext'; import './add/iterable/range'; import './add/iterable/repeat'; import './add/iterable/throw'; @@ -45,8 +51,8 @@ import './add/iterable-operators/buffer'; import './add/iterable-operators/catch'; import './add/iterable-operators/catchwith'; import './add/iterable-operators/chain'; -import './add/iterable-operators/concat'; import './add/iterable-operators/concatall'; +import './add/iterable-operators/concat'; import './add/iterable-operators/count'; import './add/iterable-operators/defaultifempty'; import './add/iterable-operators/distinct'; @@ -59,8 +65,8 @@ import './add/iterable-operators/except'; import './add/iterable-operators/expand'; import './add/iterable-operators/filter'; import './add/iterable-operators/finally'; -import './add/iterable-operators/find'; import './add/iterable-operators/findindex'; +import './add/iterable-operators/find'; import './add/iterable-operators/first'; import './add/iterable-operators/flatmap'; import './add/iterable-operators/flatten'; @@ -73,36 +79,36 @@ import './add/iterable-operators/intersect'; import './add/iterable-operators/isempty'; import './add/iterable-operators/last'; import './add/iterable-operators/map'; -import './add/iterable-operators/max'; import './add/iterable-operators/maxby'; +import './add/iterable-operators/max'; import './add/iterable-operators/memoize'; -import './add/iterable-operators/min'; import './add/iterable-operators/minby'; +import './add/iterable-operators/min'; import './add/iterable-operators/onerrorresumenext'; import './add/iterable-operators/orderby'; import './add/iterable-operators/pairwise'; import './add/iterable-operators/partition'; import './add/iterable-operators/pluck'; import './add/iterable-operators/publish'; -import './add/iterable-operators/reduce'; import './add/iterable-operators/reduceright'; +import './add/iterable-operators/reduce'; import './add/iterable-operators/repeat'; import './add/iterable-operators/retry'; import './add/iterable-operators/reverse'; -import './add/iterable-operators/scan'; import './add/iterable-operators/scanright'; +import './add/iterable-operators/scan'; import './add/iterable-operators/sequenceequal'; import './add/iterable-operators/share'; import './add/iterable-operators/single'; -import './add/iterable-operators/skip'; import './add/iterable-operators/skiplast'; +import './add/iterable-operators/skip'; import './add/iterable-operators/skipwhile'; import './add/iterable-operators/slice'; import './add/iterable-operators/some'; import './add/iterable-operators/startwith'; import './add/iterable-operators/sum'; -import './add/iterable-operators/take'; import './add/iterable-operators/takelast'; +import './add/iterable-operators/take'; import './add/iterable-operators/takewhile'; import './add/iterable-operators/tap'; import './add/iterable-operators/toarray'; @@ -112,8 +118,8 @@ import './add/iterable-operators/union'; import './add/iterable-operators/zip'; // async iterable statics -import './add/asynciterable/asyncify'; import './add/asynciterable/asyncifyerrback'; +import './add/asynciterable/asyncify'; import './add/asynciterable/case'; import './add/asynciterable/catch'; import './add/asynciterable/combinelatest'; @@ -121,14 +127,22 @@ import './add/asynciterable/concat'; import './add/asynciterable/create'; import './add/asynciterable/defer'; import './add/asynciterable/empty'; -import './add/asynciterable/for'; import './add/asynciterable/forkjoin'; -import './add/asynciterable/fromevent'; +import './add/asynciterable/for'; import './add/asynciterable/fromeventpattern'; +import './add/asynciterable/fromevent'; +import './add/asynciterable/generatetime'; +import './add/asynciterable/generate'; +import './add/asynciterable/if'; +import './add/asynciterable/merge'; +import './add/asynciterable/ofentries'; +import './add/asynciterable/ofkeys'; +import './add/asynciterable/onerrorresumenext'; import './add/asynciterable/race'; import './add/asynciterable/range'; import './add/asynciterable/repeat'; import './add/asynciterable/throw'; +import './add/asynciterable/while'; import './add/asynciterable/zip'; // async iterable operators @@ -139,8 +153,8 @@ import './add/asynciterable-operators/catch'; import './add/asynciterable-operators/catchwith'; import './add/asynciterable-operators/chain'; import './add/asynciterable-operators/combinelatest'; -import './add/asynciterable-operators/concat'; import './add/asynciterable-operators/concatall'; +import './add/asynciterable-operators/concat'; import './add/asynciterable-operators/count'; import './add/asynciterable-operators/debounce'; import './add/asynciterable-operators/defaultifempty'; @@ -154,8 +168,8 @@ import './add/asynciterable-operators/except'; import './add/asynciterable-operators/expand'; import './add/asynciterable-operators/filter'; import './add/asynciterable-operators/finally'; -import './add/asynciterable-operators/find'; import './add/asynciterable-operators/findindex'; +import './add/asynciterable-operators/find'; import './add/asynciterable-operators/first'; import './add/asynciterable-operators/flatmap'; import './add/asynciterable-operators/flatten'; @@ -169,39 +183,39 @@ import './add/asynciterable-operators/intersect'; import './add/asynciterable-operators/isempty'; import './add/asynciterable-operators/last'; import './add/asynciterable-operators/map'; -import './add/asynciterable-operators/max'; import './add/asynciterable-operators/maxby'; +import './add/asynciterable-operators/max'; import './add/asynciterable-operators/memoize'; -import './add/asynciterable-operators/merge'; import './add/asynciterable-operators/mergeall'; -import './add/asynciterable-operators/min'; +import './add/asynciterable-operators/merge'; import './add/asynciterable-operators/minby'; +import './add/asynciterable-operators/min'; import './add/asynciterable-operators/onerrorresumenext'; import './add/asynciterable-operators/orderby'; import './add/asynciterable-operators/pairwise'; import './add/asynciterable-operators/partition'; import './add/asynciterable-operators/pluck'; import './add/asynciterable-operators/publish'; -import './add/asynciterable-operators/reduce'; import './add/asynciterable-operators/reduceright'; +import './add/asynciterable-operators/reduce'; import './add/asynciterable-operators/repeat'; import './add/asynciterable-operators/retry'; import './add/asynciterable-operators/reverse'; -import './add/asynciterable-operators/scan'; import './add/asynciterable-operators/scanright'; +import './add/asynciterable-operators/scan'; import './add/asynciterable-operators/sequenceequal'; import './add/asynciterable-operators/share'; import './add/asynciterable-operators/single'; -import './add/asynciterable-operators/skip'; import './add/asynciterable-operators/skiplast'; +import './add/asynciterable-operators/skip'; import './add/asynciterable-operators/skipuntil'; import './add/asynciterable-operators/skipwhile'; import './add/asynciterable-operators/slice'; import './add/asynciterable-operators/some'; import './add/asynciterable-operators/startwith'; import './add/asynciterable-operators/sum'; -import './add/asynciterable-operators/take'; import './add/asynciterable-operators/takelast'; +import './add/asynciterable-operators/take'; import './add/asynciterable-operators/takeuntil'; import './add/asynciterable-operators/takewhile'; import './add/asynciterable-operators/tap'; diff --git a/src/add/asynciterable-operators/scan.ts b/src/add/asynciterable-operators/scan.ts index 5e97d37c..542693e5 100644 --- a/src/add/asynciterable-operators/scan.ts +++ b/src/add/asynciterable-operators/scan.ts @@ -3,12 +3,12 @@ import { scan } from '../../asynciterable/scan'; export function scanProto( this: AsyncIterableX, - accumulator: (previousValue: R, currentValue: T, currentIndex: number) => R, + accumulator: (previousValue: R, currentValue: T, currentIndex: number) => R | Promise, seed?: never[] ): AsyncIterableX; export function scanProto( this: AsyncIterableX, - accumulator: (previousValue: R, currentValue: T, currentIndex: number) => R, + accumulator: (previousValue: R, currentValue: T, currentIndex: number) => R | Promise, seed?: R ): AsyncIterableX; /** @@ -16,7 +16,7 @@ export function scanProto( */ export function scanProto( this: AsyncIterableX, - accumulator: (previousValue: R, currentValue: T, currentIndex: number) => R, + accumulator: (previousValue: R, currentValue: T, currentIndex: number) => R | Promise, ...seed: R[] ): AsyncIterableX { return scan(this, accumulator, ...seed);