@cspell/cspell-pipe 6.18.0 → 6.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/helpers/distribute.d.ts +13 -0
- package/dist/cjs/helpers/index.d.ts +7 -0
- package/dist/cjs/helpers/interleave.d.ts +2 -0
- package/dist/cjs/helpers/iteratorToIterable.d.ts +3 -0
- package/dist/cjs/helpers/toArray.d.ts +6 -0
- package/dist/cjs/helpers/toAsyncIterable.d.ts +11 -0
- package/dist/cjs/helpers/util.d.ts +4 -0
- package/dist/cjs/index.cjs +644 -0
- package/dist/cjs/index.d.ts +9 -0
- package/dist/cjs/internalTypes.d.ts +17 -0
- package/dist/{operators/append.js → cjs/operators/append.cjs} +10 -8
- package/dist/cjs/operators/append.d.ts +15 -0
- package/dist/{operators/await.js → cjs/operators/await.cjs} +3 -4
- package/dist/cjs/operators/await.d.ts +2 -0
- package/dist/{operators/combine.js → cjs/operators/combine.cjs} +4 -5
- package/dist/cjs/operators/combine.d.ts +23 -0
- package/dist/{operators/concatMap.js → cjs/operators/concatMap.cjs} +16 -8
- package/dist/cjs/operators/concatMap.d.ts +4 -0
- package/dist/{operators/filter.js → cjs/operators/filter.cjs} +10 -8
- package/dist/cjs/operators/filter.d.ts +10 -0
- package/dist/{operators/first.js → cjs/operators/first.cjs} +10 -8
- package/dist/cjs/operators/first.d.ts +10 -0
- package/dist/{operators/flatten.js → cjs/operators/flatten.cjs} +16 -8
- package/dist/cjs/operators/flatten.d.ts +4 -0
- package/dist/cjs/operators/helpers/distribute.d.ts +13 -0
- package/dist/cjs/operators/helpers/index.d.ts +7 -0
- package/dist/cjs/operators/helpers/interleave.d.ts +2 -0
- package/dist/cjs/operators/helpers/iteratorToIterable.d.ts +3 -0
- package/dist/cjs/operators/helpers/toArray.d.ts +6 -0
- package/dist/cjs/operators/helpers/toAsyncIterable.d.ts +11 -0
- package/dist/cjs/operators/helpers/util.d.ts +4 -0
- package/dist/cjs/operators/index.cjs +508 -0
- package/dist/cjs/operators/index.d.ts +17 -0
- package/dist/cjs/operators/internalTypes.d.ts +17 -0
- package/dist/cjs/operators/joinStrings.cjs +49 -0
- package/dist/cjs/operators/joinStrings.d.ts +4 -0
- package/dist/{operators/last.js → cjs/operators/last.cjs} +10 -8
- package/dist/cjs/operators/last.d.ts +10 -0
- package/dist/{operators/map.js → cjs/operators/map.cjs} +16 -8
- package/dist/cjs/operators/map.d.ts +4 -0
- package/dist/cjs/operators/operators/append.d.ts +15 -0
- package/dist/cjs/operators/operators/await.d.ts +2 -0
- package/dist/cjs/operators/operators/combine.d.ts +23 -0
- package/dist/cjs/operators/operators/concatMap.d.ts +4 -0
- package/dist/cjs/operators/operators/filter.d.ts +10 -0
- package/dist/cjs/operators/operators/first.d.ts +10 -0
- package/dist/cjs/operators/operators/flatten.d.ts +4 -0
- package/dist/cjs/operators/operators/index.d.ts +17 -0
- package/dist/cjs/operators/operators/joinStrings.d.ts +4 -0
- package/dist/cjs/operators/operators/last.d.ts +10 -0
- package/dist/cjs/operators/operators/map.d.ts +4 -0
- package/dist/cjs/operators/operators/reduce.d.ts +7 -0
- package/dist/cjs/operators/operators/skip.d.ts +4 -0
- package/dist/cjs/operators/operators/take.d.ts +8 -0
- package/dist/cjs/operators/operators/tap.d.ts +19 -0
- package/dist/cjs/operators/operators/types.d.ts +4 -0
- package/dist/cjs/operators/operators/unique.d.ts +4 -0
- package/dist/cjs/operators/pipe.d.ts +20 -0
- package/dist/{operators/reduce.js → cjs/operators/reduce.cjs} +22 -11
- package/dist/cjs/operators/reduce.d.ts +7 -0
- package/dist/{operators/skip.js → cjs/operators/skip.cjs} +16 -8
- package/dist/cjs/operators/skip.d.ts +4 -0
- package/dist/cjs/operators/sync/index.d.ts +6 -0
- package/dist/{operators/take.js → cjs/operators/take.cjs} +16 -8
- package/dist/cjs/operators/take.d.ts +8 -0
- package/dist/{operators/tap.js → cjs/operators/tap.cjs} +16 -8
- package/dist/cjs/operators/tap.d.ts +19 -0
- package/dist/cjs/operators/types.cjs +2 -0
- package/dist/cjs/operators/types.d.ts +4 -0
- package/dist/{operators/unique.js → cjs/operators/unique.cjs} +16 -8
- package/dist/cjs/operators/unique.d.ts +4 -0
- package/dist/cjs/pipe.d.ts +20 -0
- package/dist/cjs/reduce.d.ts +16 -0
- package/dist/cjs/sync/helpers/distribute.d.ts +13 -0
- package/dist/cjs/sync/helpers/index.d.ts +7 -0
- package/dist/cjs/sync/helpers/interleave.d.ts +2 -0
- package/dist/cjs/sync/helpers/iteratorToIterable.d.ts +3 -0
- package/dist/cjs/sync/helpers/toArray.d.ts +6 -0
- package/dist/cjs/sync/helpers/toAsyncIterable.d.ts +11 -0
- package/dist/cjs/sync/helpers/util.d.ts +4 -0
- package/dist/cjs/sync/index.cjs +245 -0
- package/dist/cjs/sync/index.d.ts +6 -0
- package/dist/cjs/sync/internalTypes.d.ts +17 -0
- package/dist/cjs/sync/operators/append.d.ts +15 -0
- package/dist/cjs/sync/operators/await.d.ts +2 -0
- package/dist/cjs/sync/operators/combine.d.ts +23 -0
- package/dist/cjs/sync/operators/concatMap.d.ts +4 -0
- package/dist/cjs/sync/operators/filter.d.ts +10 -0
- package/dist/cjs/sync/operators/first.d.ts +10 -0
- package/dist/cjs/sync/operators/flatten.d.ts +4 -0
- package/dist/cjs/sync/operators/index.d.ts +17 -0
- package/dist/cjs/sync/operators/joinStrings.d.ts +4 -0
- package/dist/cjs/sync/operators/last.d.ts +10 -0
- package/dist/cjs/sync/operators/map.d.ts +4 -0
- package/dist/cjs/sync/operators/reduce.d.ts +7 -0
- package/dist/cjs/sync/operators/skip.d.ts +4 -0
- package/dist/cjs/sync/operators/take.d.ts +8 -0
- package/dist/cjs/sync/operators/tap.d.ts +19 -0
- package/dist/cjs/sync/operators/types.d.ts +4 -0
- package/dist/cjs/sync/operators/unique.d.ts +4 -0
- package/dist/cjs/sync/pipe.d.ts +20 -0
- package/dist/cjs/sync/reduce.d.ts +16 -0
- package/dist/cjs/sync/sync/index.d.ts +6 -0
- package/dist/esm/helpers/distribute.d.ts +13 -0
- package/dist/{helpers → esm/helpers}/distribute.js +2 -6
- package/dist/esm/helpers/index.d.ts +7 -0
- package/dist/esm/helpers/index.js +7 -0
- package/dist/esm/helpers/interleave.d.ts +2 -0
- package/dist/{helpers → esm/helpers}/interleave.js +1 -5
- package/dist/esm/helpers/iteratorToIterable.d.ts +3 -0
- package/dist/esm/helpers/iteratorToIterable.js +13 -0
- package/dist/esm/helpers/toArray.d.ts +6 -0
- package/dist/esm/helpers/toArray.js +15 -0
- package/dist/esm/helpers/toAsyncIterable.d.ts +11 -0
- package/dist/esm/helpers/toAsyncIterable.js +15 -0
- package/dist/esm/helpers/util.d.ts +4 -0
- package/dist/esm/helpers/util.js +10 -0
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/internalTypes.d.ts +17 -0
- package/dist/esm/internalTypes.js +2 -0
- package/dist/esm/operators/append.d.ts +15 -0
- package/dist/esm/operators/append.js +36 -0
- package/dist/esm/operators/await.d.ts +2 -0
- package/dist/esm/operators/await.js +9 -0
- package/dist/esm/operators/combine.d.ts +23 -0
- package/dist/esm/operators/combine.js +19 -0
- package/dist/esm/operators/concatMap.d.ts +4 -0
- package/dist/esm/operators/concatMap.js +19 -0
- package/dist/esm/operators/filter.d.ts +10 -0
- package/dist/esm/operators/filter.js +30 -0
- package/dist/esm/operators/first.d.ts +10 -0
- package/dist/esm/operators/first.js +34 -0
- package/dist/esm/operators/flatten.d.ts +4 -0
- package/dist/esm/operators/flatten.js +19 -0
- package/dist/esm/operators/index.d.ts +17 -0
- package/dist/esm/operators/index.js +16 -0
- package/dist/esm/operators/joinStrings.d.ts +4 -0
- package/dist/esm/operators/joinStrings.js +22 -0
- package/dist/esm/operators/last.d.ts +10 -0
- package/dist/esm/operators/last.js +39 -0
- package/dist/esm/operators/map.d.ts +4 -0
- package/dist/esm/operators/map.js +19 -0
- package/dist/esm/operators/reduce.d.ts +7 -0
- package/dist/esm/operators/reduce.js +49 -0
- package/dist/esm/operators/skip.d.ts +4 -0
- package/dist/esm/operators/skip.js +27 -0
- package/dist/esm/operators/take.d.ts +8 -0
- package/dist/esm/operators/take.js +31 -0
- package/dist/esm/operators/tap.d.ts +19 -0
- package/dist/esm/operators/tap.js +36 -0
- package/dist/esm/operators/types.d.ts +4 -0
- package/dist/esm/operators/types.js +2 -0
- package/dist/esm/operators/unique.d.ts +4 -0
- package/dist/esm/operators/unique.js +53 -0
- package/dist/esm/pipe.d.ts +20 -0
- package/dist/esm/pipe.js +10 -0
- package/dist/esm/reduce.d.ts +16 -0
- package/dist/esm/reduce.js +21 -0
- package/dist/esm/sync/index.d.ts +6 -0
- package/dist/esm/sync/index.js +5 -0
- package/dist/helpers/index.d.ts +6 -6
- package/dist/helpers/toAsyncIterable.d.ts +1 -1
- package/dist/helpers/util.d.ts +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/operators/append.d.ts +1 -1
- package/dist/operators/combine.d.ts +2 -2
- package/dist/operators/concatMap.d.ts +1 -1
- package/dist/operators/filter.d.ts +1 -1
- package/dist/operators/first.d.ts +1 -1
- package/dist/operators/flatten.d.ts +1 -1
- package/dist/operators/index.d.ts +16 -16
- package/dist/operators/joinStrings.d.ts +1 -1
- package/dist/operators/last.d.ts +1 -1
- package/dist/operators/map.d.ts +1 -1
- package/dist/operators/skip.d.ts +1 -1
- package/dist/operators/take.d.ts +1 -1
- package/dist/operators/tap.d.ts +1 -1
- package/dist/operators/unique.d.ts +1 -1
- package/dist/pipe.d.ts +1 -1
- package/dist/reduce.d.ts +1 -1
- package/dist/sync/index.d.ts +5 -5
- package/package.json +59 -25
- package/dist/helpers/index.js +0 -17
- package/dist/helpers/iteratorToIterable.js +0 -18
- package/dist/helpers/toArray.js +0 -21
- package/dist/helpers/toAsyncIterable.js +0 -19
- package/dist/helpers/util.js +0 -15
- package/dist/index.js +0 -58
- package/dist/internalTypes.js +0 -3
- package/dist/operators/index.js +0 -60
- package/dist/operators/joinStrings.js +0 -28
- package/dist/operators/types.js +0 -3
- package/dist/pipe.js +0 -15
- package/dist/reduce.js +0 -26
- package/dist/sync/index.js +0 -26
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface PipeFnSync<T, U> {
|
|
2
|
+
(iter: Iterable<T>): Iterable<U>;
|
|
3
|
+
/** This is just to help TypeScript figure out the type. */
|
|
4
|
+
__PipeFnSync__?: [T, U];
|
|
5
|
+
}
|
|
6
|
+
export interface PipeFnAsync<T, U> {
|
|
7
|
+
(iter: AsyncIterable<T>): AsyncIterable<U>;
|
|
8
|
+
/** This is just to help TypeScript figure out the type. */
|
|
9
|
+
__PipeFnAsync__?: [T, U];
|
|
10
|
+
}
|
|
11
|
+
export type PipeFn<T, U> = PipeFnSync<T, U> & PipeFnAsync<T, U>;
|
|
12
|
+
export type PsFn<T, U> = PipeFnSync<T, U> | ((i: Iterable<T>) => Iterable<U>);
|
|
13
|
+
export type AnyIterable<T> = Iterable<T> | AsyncIterable<T> | Promise<Iterable<T>> | Iterable<Promise<T>>;
|
|
14
|
+
export type PaFn<T, U> = PipeFnAsync<T, U> | ((i: AsyncIterable<T>) => AsyncIterable<U>);
|
|
15
|
+
export type PipeAsyncTx<T extends [...any]> = T extends [infer Left, infer Right, ...infer Rest] ? Rest extends [any, ...any] ? [PaFn<Left, Right>, ...PipeAsyncTx<[Right, ...Rest]>] : [PaFn<Left, Right>] : never;
|
|
16
|
+
export type PipeSyncTx<T extends [...any]> = T extends [infer Left, infer Right, ...infer Rest] ? Rest extends [any, ...any] ? [PsFn<Left, Right>, ...PipeSyncTx<[Right, ...Rest]>] : [PsFn<Left, Right>] : never;
|
|
17
|
+
//# sourceMappingURL=internalTypes.d.ts.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function isAsyncIterable(i) {
|
|
4
|
+
return typeof i[Symbol.asyncIterator] === 'function';
|
|
5
|
+
}
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* Append values onto the end of an iterable.
|
|
7
9
|
* @param iterablesToAppend - the iterables in the order to be appended.
|
|
@@ -16,7 +18,6 @@ function opAppendAsync(...iterablesToAppend) {
|
|
|
16
18
|
}
|
|
17
19
|
return fn;
|
|
18
20
|
}
|
|
19
|
-
exports.opAppendAsync = opAppendAsync;
|
|
20
21
|
/**
|
|
21
22
|
* Append values onto the end of an iterable.
|
|
22
23
|
* @param iterablesToAppend - the iterables in the order to be appended.
|
|
@@ -31,12 +32,13 @@ function opAppendSync(...iterablesToAppend) {
|
|
|
31
32
|
}
|
|
32
33
|
return fn;
|
|
33
34
|
}
|
|
34
|
-
exports.opAppendSync = opAppendSync;
|
|
35
35
|
function opAppend(...iterablesToAppend) {
|
|
36
36
|
function _(i) {
|
|
37
|
-
return
|
|
37
|
+
return isAsyncIterable(i) ? opAppendAsync(...iterablesToAppend)(i) : opAppendSync(...iterablesToAppend)(i);
|
|
38
38
|
}
|
|
39
39
|
return _;
|
|
40
40
|
}
|
|
41
|
+
|
|
41
42
|
exports.opAppend = opAppend;
|
|
42
|
-
|
|
43
|
+
exports.opAppendAsync = opAppendAsync;
|
|
44
|
+
exports.opAppendSync = opAppendSync;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PipeFn } from '../internalTypes.js';
|
|
2
|
+
/**
|
|
3
|
+
* Append values onto the end of an iterable.
|
|
4
|
+
* @param iterablesToAppend - the iterables in the order to be appended.
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare function opAppendAsync<T>(...iterablesToAppend: (AsyncIterable<T> | Iterable<T>)[]): (iter: AsyncIterable<T> | Iterable<T>) => AsyncIterable<T>;
|
|
8
|
+
/**
|
|
9
|
+
* Append values onto the end of an iterable.
|
|
10
|
+
* @param iterablesToAppend - the iterables in the order to be appended.
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export declare function opAppendSync<T>(...iterablesToAppend: Iterable<T>[]): (iter: Iterable<T>) => Iterable<T>;
|
|
14
|
+
export declare function opAppend<T>(...iterablesToAppend: Iterable<T>[]): PipeFn<T, T>;
|
|
15
|
+
//# sourceMappingURL=append.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.opAwaitAsync = void 0;
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
4
3
|
async function* _asyncAwait(iter) {
|
|
5
4
|
for await (const v of iter) {
|
|
6
5
|
yield v;
|
|
@@ -9,5 +8,5 @@ async function* _asyncAwait(iter) {
|
|
|
9
8
|
function opAwaitAsync() {
|
|
10
9
|
return _asyncAwait;
|
|
11
10
|
}
|
|
11
|
+
|
|
12
12
|
exports.opAwaitAsync = opAwaitAsync;
|
|
13
|
-
//# sourceMappingURL=await.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.opCombineSync = exports.opCombineAsync = void 0;
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
4
3
|
function opCombineAsync(...fns) {
|
|
5
4
|
function combine(iter) {
|
|
6
5
|
for (const fn of fns) {
|
|
@@ -10,7 +9,6 @@ function opCombineAsync(...fns) {
|
|
|
10
9
|
}
|
|
11
10
|
return combine;
|
|
12
11
|
}
|
|
13
|
-
exports.opCombineAsync = opCombineAsync;
|
|
14
12
|
function opCombineSync(...fns) {
|
|
15
13
|
function combine(iter) {
|
|
16
14
|
for (const fn of fns) {
|
|
@@ -20,5 +18,6 @@ function opCombineSync(...fns) {
|
|
|
20
18
|
}
|
|
21
19
|
return combine;
|
|
22
20
|
}
|
|
21
|
+
|
|
22
|
+
exports.opCombineAsync = opCombineAsync;
|
|
23
23
|
exports.opCombineSync = opCombineSync;
|
|
24
|
-
//# sourceMappingURL=combine.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PaFn, PipeAsyncTx, PipeSyncTx, PsFn } from '../internalTypes.js';
|
|
2
|
+
import type { OperatorAsync, OperatorSync } from './types.js';
|
|
3
|
+
export declare function opCombineAsync<T>(): OperatorAsync<T>;
|
|
4
|
+
export declare function opCombineAsync<T, T0>(...f: PipeAsyncTx<[T, T0]>): OperatorAsync<T0>;
|
|
5
|
+
export declare function opCombineAsync<T, T0, T1>(...f: PipeAsyncTx<[T, T0, T1]>): OperatorAsync<T1>;
|
|
6
|
+
export declare function opCombineAsync<T, T0, T1, T2>(...f: PipeAsyncTx<[T, T0, T1, T2]>): OperatorAsync<T2>;
|
|
7
|
+
export declare function opCombineAsync<T, T0, T1, T2, T3>(...f: PipeAsyncTx<[T, T0, T1, T2, T3]>): OperatorAsync<T3>;
|
|
8
|
+
export declare function opCombineAsync<T, T0, T1, T2, T3, T4>(...f: PipeAsyncTx<[T, T0, T1, T2, T3, T4]>): OperatorAsync<T4>;
|
|
9
|
+
export declare function opCombineAsync<T, T0, T1, T2, T3, T4, T5>(...f: PipeAsyncTx<[T, T0, T1, T2, T3, T4, T5]>): OperatorAsync<T5>;
|
|
10
|
+
export declare function opCombineAsync<T, T0, T1, T2, T3, T4, T5, T6>(...f: PipeAsyncTx<[T, T0, T1, T2, T3, T4, T5, T6]>): OperatorAsync<T6>;
|
|
11
|
+
export declare function opCombineAsync<T, T0, T1, T2, T3, T4, T5, T6, T7>(...f: PipeAsyncTx<[T, T0, T1, T2, T3, T4, T5, T6, T7]>): OperatorAsync<T7>;
|
|
12
|
+
export declare function opCombineAsync<T>(...fns: PaFn<T, T>[]): OperatorAsync<T>;
|
|
13
|
+
export declare function opCombineSync<T>(): OperatorSync<T>;
|
|
14
|
+
export declare function opCombineSync<T, T0 = T>(...f: PipeSyncTx<[T, T0]>): OperatorSync<T0>;
|
|
15
|
+
export declare function opCombineSync<T, T0, T1>(...f: PipeSyncTx<[T, T0, T1]>): OperatorSync<T1>;
|
|
16
|
+
export declare function opCombineSync<T, T0, T1, T2>(...f: PipeSyncTx<[T, T0, T1, T2]>): OperatorSync<T2>;
|
|
17
|
+
export declare function opCombineSync<T, T0, T1, T2, T3>(...f: PipeSyncTx<[T, T0, T1, T2, T3]>): OperatorSync<T3>;
|
|
18
|
+
export declare function opCombineSync<T, T0, T1, T2, T3, T4>(...f: PipeSyncTx<[T, T0, T1, T2, T3, T4]>): OperatorSync<T4>;
|
|
19
|
+
export declare function opCombineSync<T, T0, T1, T2, T3, T4, T5>(...f: PipeSyncTx<[T, T0, T1, T2, T3, T4, T5]>): OperatorSync<T5>;
|
|
20
|
+
export declare function opCombineSync<T, T0, T1, T2, T3, T4, T5, T6>(...f: PipeSyncTx<[T, T0, T1, T2, T3, T4, T5, T6]>): OperatorSync<T6>;
|
|
21
|
+
export declare function opCombineSync<T, T0, T1, T2, T3, T4, T5, T6, T7>(...f: PipeSyncTx<[T, T0, T1, T2, T3, T4, T5, T6, T7]>): OperatorSync<T7>;
|
|
22
|
+
export declare function opCombineSync<T>(...fns: PsFn<T, T>[]): OperatorSync<T>;
|
|
23
|
+
//# sourceMappingURL=combine.d.ts.map
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function toPipeFn(syncFn, asyncFn) {
|
|
4
|
+
function _(i) {
|
|
5
|
+
return isAsyncIterable(i) ? asyncFn(i) : syncFn(i);
|
|
6
|
+
}
|
|
7
|
+
return _;
|
|
8
|
+
}
|
|
9
|
+
function isAsyncIterable(i) {
|
|
10
|
+
return typeof i[Symbol.asyncIterator] === 'function';
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
function opConcatMapAsync(mapFn) {
|
|
6
14
|
async function* fn(iter) {
|
|
7
15
|
for await (const v of iter) {
|
|
@@ -10,7 +18,6 @@ function opConcatMapAsync(mapFn) {
|
|
|
10
18
|
}
|
|
11
19
|
return fn;
|
|
12
20
|
}
|
|
13
|
-
exports.opConcatMapAsync = opConcatMapAsync;
|
|
14
21
|
function opConcatMapSync(mapFn) {
|
|
15
22
|
function* fn(iter) {
|
|
16
23
|
for (const v of iter) {
|
|
@@ -19,7 +26,8 @@ function opConcatMapSync(mapFn) {
|
|
|
19
26
|
}
|
|
20
27
|
return fn;
|
|
21
28
|
}
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
const opConcatMap = (fn) => toPipeFn(opConcatMapSync(fn), opConcatMapAsync(fn));
|
|
30
|
+
|
|
24
31
|
exports.opConcatMap = opConcatMap;
|
|
25
|
-
|
|
32
|
+
exports.opConcatMapAsync = opConcatMapAsync;
|
|
33
|
+
exports.opConcatMapSync = opConcatMapSync;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function opConcatMapAsync<T, U = T>(mapFn: (v: T) => AsyncIterable<U> | Iterable<U>): (iter: AsyncIterable<T>) => AsyncIterable<U>;
|
|
2
|
+
export declare function opConcatMapSync<T, U = T>(mapFn: (v: T) => Iterable<U>): (iter: Iterable<T>) => Iterable<U>;
|
|
3
|
+
export declare const opConcatMap: <T, U>(fn: (v: T) => Iterable<U>) => import("../internalTypes.js").PipeFn<T, U>;
|
|
4
|
+
//# sourceMappingURL=concatMap.d.ts.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function isAsyncIterable(i) {
|
|
4
|
+
return typeof i[Symbol.asyncIterator] === 'function';
|
|
5
|
+
}
|
|
6
|
+
|
|
5
7
|
// prettier-ignore
|
|
6
8
|
function opFilterAsync(filterFn) {
|
|
7
9
|
async function* fn(iter) {
|
|
@@ -13,7 +15,6 @@ function opFilterAsync(filterFn) {
|
|
|
13
15
|
}
|
|
14
16
|
return fn;
|
|
15
17
|
}
|
|
16
|
-
exports.opFilterAsync = opFilterAsync;
|
|
17
18
|
function opFilterSync(filterFn) {
|
|
18
19
|
function* fn(iter) {
|
|
19
20
|
for (const v of iter) {
|
|
@@ -23,14 +24,15 @@ function opFilterSync(filterFn) {
|
|
|
23
24
|
}
|
|
24
25
|
return fn;
|
|
25
26
|
}
|
|
26
|
-
exports.opFilterSync = opFilterSync;
|
|
27
27
|
function opFilter(fn) {
|
|
28
28
|
const asyncFn = opFilterAsync(fn);
|
|
29
29
|
const syncFn = opFilterSync(fn);
|
|
30
30
|
function _(i) {
|
|
31
|
-
return
|
|
31
|
+
return isAsyncIterable(i) ? asyncFn(i) : syncFn(i);
|
|
32
32
|
}
|
|
33
33
|
return _;
|
|
34
34
|
}
|
|
35
|
+
|
|
35
36
|
exports.opFilter = opFilter;
|
|
36
|
-
|
|
37
|
+
exports.opFilterAsync = opFilterAsync;
|
|
38
|
+
exports.opFilterSync = opFilterSync;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PipeFn } from '../internalTypes.js';
|
|
2
|
+
export declare function opFilterAsync<T, S extends T>(filterFn: (v: T) => v is S): (iter: AsyncIterable<T>) => AsyncIterable<S>;
|
|
3
|
+
export declare function opFilterAsync<T, S extends Awaited<T>>(filterFn: (v: Awaited<T>) => v is S): (iter: AsyncIterable<T>) => AsyncIterable<S>;
|
|
4
|
+
export declare function opFilterAsync<T>(filterFn: (v: Awaited<T>) => boolean): (iter: AsyncIterable<T>) => AsyncIterable<Awaited<T>>;
|
|
5
|
+
export declare function opFilterAsync<T>(filterFn: (v: Awaited<T>) => Promise<boolean>): (iter: AsyncIterable<T>) => AsyncIterable<Awaited<T>>;
|
|
6
|
+
export declare function opFilterSync<T, S extends T>(filterFn: (v: T) => v is S): (iter: Iterable<T>) => Iterable<S>;
|
|
7
|
+
export declare function opFilterSync<T>(filterFn: (v: T) => boolean): (iter: Iterable<T>) => Iterable<T>;
|
|
8
|
+
export declare function opFilter<T, S extends T>(fn: (v: T) => v is S): PipeFn<T, S>;
|
|
9
|
+
export declare function opFilter<T>(fn: (v: T) => boolean): PipeFn<T, T>;
|
|
10
|
+
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function isAsyncIterable(i) {
|
|
4
|
+
return typeof i[Symbol.asyncIterator] === 'function';
|
|
5
|
+
}
|
|
6
|
+
|
|
5
7
|
// prettier-ignore
|
|
6
8
|
function opFirstAsync(firstFn) {
|
|
7
9
|
async function* fn(iter) {
|
|
@@ -15,7 +17,6 @@ function opFirstAsync(firstFn) {
|
|
|
15
17
|
}
|
|
16
18
|
return fn;
|
|
17
19
|
}
|
|
18
|
-
exports.opFirstAsync = opFirstAsync;
|
|
19
20
|
function opFirstSync(firstFn) {
|
|
20
21
|
function* fn(iter) {
|
|
21
22
|
for (const v of iter) {
|
|
@@ -27,14 +28,15 @@ function opFirstSync(firstFn) {
|
|
|
27
28
|
}
|
|
28
29
|
return fn;
|
|
29
30
|
}
|
|
30
|
-
exports.opFirstSync = opFirstSync;
|
|
31
31
|
function opFirst(fn) {
|
|
32
32
|
const asyncFn = opFirstAsync(fn);
|
|
33
33
|
const syncFn = opFirstSync(fn);
|
|
34
34
|
function _(i) {
|
|
35
|
-
return
|
|
35
|
+
return isAsyncIterable(i) ? asyncFn(i) : syncFn(i);
|
|
36
36
|
}
|
|
37
37
|
return _;
|
|
38
38
|
}
|
|
39
|
+
|
|
39
40
|
exports.opFirst = opFirst;
|
|
40
|
-
|
|
41
|
+
exports.opFirstAsync = opFirstAsync;
|
|
42
|
+
exports.opFirstSync = opFirstSync;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PipeFn } from '../internalTypes.js';
|
|
2
|
+
export declare function opFirstAsync<T, S extends T>(firstFn: (v: T) => v is S): (iter: AsyncIterable<T>) => AsyncIterable<S>;
|
|
3
|
+
export declare function opFirstAsync<T, S extends Awaited<T>>(firstFn: (v: Awaited<T>) => v is S): (iter: AsyncIterable<T>) => AsyncIterable<S>;
|
|
4
|
+
export declare function opFirstAsync<T>(firstFn: (v: Awaited<T>) => boolean): (iter: AsyncIterable<T>) => AsyncIterable<Awaited<T>>;
|
|
5
|
+
export declare function opFirstAsync<T>(firstFn: (v: Awaited<T>) => Promise<boolean>): (iter: AsyncIterable<T>) => AsyncIterable<Awaited<T>>;
|
|
6
|
+
export declare function opFirstSync<T, S extends T>(firstFn: (v: T) => v is S): (iter: Iterable<T>) => Iterable<S>;
|
|
7
|
+
export declare function opFirstSync<T>(firstFn: (v: T) => boolean): (iter: Iterable<T>) => Iterable<T>;
|
|
8
|
+
export declare function opFirst<T, S extends T>(fn: (v: T) => v is S): PipeFn<T, S>;
|
|
9
|
+
export declare function opFirst<T>(fn: (v: T) => boolean): PipeFn<T, T>;
|
|
10
|
+
//# sourceMappingURL=first.d.ts.map
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function toPipeFn(syncFn, asyncFn) {
|
|
4
|
+
function _(i) {
|
|
5
|
+
return isAsyncIterable(i) ? asyncFn(i) : syncFn(i);
|
|
6
|
+
}
|
|
7
|
+
return _;
|
|
8
|
+
}
|
|
9
|
+
function isAsyncIterable(i) {
|
|
10
|
+
return typeof i[Symbol.asyncIterator] === 'function';
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
function opFlattenAsync() {
|
|
6
14
|
async function* fn(iter) {
|
|
7
15
|
for await (const v of iter) {
|
|
@@ -10,7 +18,6 @@ function opFlattenAsync() {
|
|
|
10
18
|
}
|
|
11
19
|
return fn;
|
|
12
20
|
}
|
|
13
|
-
exports.opFlattenAsync = opFlattenAsync;
|
|
14
21
|
function opFlattenSync() {
|
|
15
22
|
function* fn(iter) {
|
|
16
23
|
for (const v of iter) {
|
|
@@ -19,7 +26,8 @@ function opFlattenSync() {
|
|
|
19
26
|
}
|
|
20
27
|
return fn;
|
|
21
28
|
}
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
const opFlatten = () => toPipeFn(opFlattenSync(), opFlattenAsync());
|
|
30
|
+
|
|
24
31
|
exports.opFlatten = opFlatten;
|
|
25
|
-
|
|
32
|
+
exports.opFlattenAsync = opFlattenAsync;
|
|
33
|
+
exports.opFlattenSync = opFlattenSync;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function opFlattenAsync<T>(): (iter: AsyncIterable<AsyncIterable<T> | Iterable<T>>) => AsyncIterable<T>;
|
|
2
|
+
export declare function opFlattenSync<T>(): (iter: Iterable<Iterable<T>>) => Iterable<T>;
|
|
3
|
+
export declare const opFlatten: <T>() => import("../internalTypes.js").PipeFn<Iterable<T>, T>;
|
|
4
|
+
//# sourceMappingURL=flatten.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allows an iterable to be shared by multiple consumers.
|
|
3
|
+
* Each consumer takes from the iterable.
|
|
4
|
+
* @param iterable - the iterable to share
|
|
5
|
+
*/
|
|
6
|
+
export declare function toDistributableIterableSync<T>(iterable: Iterable<T>): Iterable<T>;
|
|
7
|
+
/**
|
|
8
|
+
* Allows an iterable to be shared by multiple consumers.
|
|
9
|
+
* Each consumer takes from the iterable.
|
|
10
|
+
* @param iterable - the iterable to share
|
|
11
|
+
*/
|
|
12
|
+
export declare const toDistributableIterable: typeof toDistributableIterableSync;
|
|
13
|
+
//# sourceMappingURL=distribute.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { toDistributableIterable } from './distribute.js';
|
|
2
|
+
export { interleave } from './interleave.js';
|
|
3
|
+
export { asyncIteratorToAsyncIterable, iteratorToIterable } from './iteratorToIterable.js';
|
|
4
|
+
export { toArray } from './toArray.js';
|
|
5
|
+
export { toAsyncIterable } from './toAsyncIterable.js';
|
|
6
|
+
export { isAsyncIterable } from './util.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function toArray<T>(i: AsyncIterable<T>): Promise<Awaited<T>[]>;
|
|
2
|
+
export declare function toArray<T>(i: Iterable<T>): T[];
|
|
3
|
+
export declare function toArray<T>(i: Iterable<T> | AsyncIterable<T>): T[] | Promise<Awaited<T>[]>;
|
|
4
|
+
export declare function toArraySync<T>(iter: Iterable<T>): T[];
|
|
5
|
+
export declare function toArrayAsync<T>(iter: AsyncIterable<T>): Promise<Awaited<T>[]>;
|
|
6
|
+
//# sourceMappingURL=toArray.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AnyIterable } from '../internalTypes.js';
|
|
2
|
+
export declare function mergeAsyncIterables<T>(iter: Iterable<T>): AsyncIterable<T>;
|
|
3
|
+
export declare function mergeAsyncIterables<T>(iter: AsyncIterable<T>): AsyncIterable<T>;
|
|
4
|
+
export declare function mergeAsyncIterables<T>(iter: Promise<Iterable<T>>): AsyncIterable<T>;
|
|
5
|
+
export declare function mergeAsyncIterables<T>(iter: AnyIterable<T>): AsyncIterable<T>;
|
|
6
|
+
export declare function mergeAsyncIterables<T>(iter: AnyIterable<T>, ...rest: AnyIterable<T>[]): AsyncIterable<T>;
|
|
7
|
+
/**
|
|
8
|
+
* Convert one or more iterables to an AsyncIterable
|
|
9
|
+
*/
|
|
10
|
+
export declare const toAsyncIterable: typeof mergeAsyncIterables;
|
|
11
|
+
//# sourceMappingURL=toAsyncIterable.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AnyIterable, PipeFn, PipeFnAsync, PipeFnSync } from '../internalTypes.js';
|
|
2
|
+
export declare function toPipeFn<T, U = T>(syncFn: PipeFnSync<T, U>, asyncFn: PipeFnAsync<T, U>): PipeFn<T, U>;
|
|
3
|
+
export declare function isAsyncIterable<T>(i: AnyIterable<T>): i is AsyncIterable<T>;
|
|
4
|
+
//# sourceMappingURL=util.d.ts.map
|