@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,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tap allows you to listen on values, without modifying them.
|
|
3
|
+
*
|
|
4
|
+
* @param fn - function to call for each value.
|
|
5
|
+
*/
|
|
6
|
+
export declare function opTapAsync<T>(tapFn: (v: T) => void): (iter: AsyncIterable<T>) => AsyncIterable<T>;
|
|
7
|
+
/**
|
|
8
|
+
* Tap allows you to listen on values, without modifying them.
|
|
9
|
+
*
|
|
10
|
+
* @param fn - function to call for each value.
|
|
11
|
+
*/
|
|
12
|
+
export declare function opTapSync<T>(tapFn: (v: T) => void): (iter: Iterable<T>) => Iterable<T>;
|
|
13
|
+
/**
|
|
14
|
+
* Tap allows you to listen on values, without modifying them.
|
|
15
|
+
*
|
|
16
|
+
* @param fn - function to call for each value.
|
|
17
|
+
*/
|
|
18
|
+
export declare const opTap: <T>(fn: (v: T) => void) => import("../internalTypes.js").PipeFn<T, T>;
|
|
19
|
+
//# sourceMappingURL=tap.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { toPipeFn } from '../helpers/util.js';
|
|
2
|
+
/**
|
|
3
|
+
* Tap allows you to listen on values, without modifying them.
|
|
4
|
+
*
|
|
5
|
+
* @param fn - function to call for each value.
|
|
6
|
+
*/
|
|
7
|
+
export function opTapAsync(tapFn) {
|
|
8
|
+
async function* fn(iter) {
|
|
9
|
+
for await (const v of iter) {
|
|
10
|
+
tapFn(v);
|
|
11
|
+
yield v;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return fn;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Tap allows you to listen on values, without modifying them.
|
|
18
|
+
*
|
|
19
|
+
* @param fn - function to call for each value.
|
|
20
|
+
*/
|
|
21
|
+
export function opTapSync(tapFn) {
|
|
22
|
+
function* fn(iter) {
|
|
23
|
+
for (const v of iter) {
|
|
24
|
+
tapFn(v);
|
|
25
|
+
yield v;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return fn;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Tap allows you to listen on values, without modifying them.
|
|
32
|
+
*
|
|
33
|
+
* @param fn - function to call for each value.
|
|
34
|
+
*/
|
|
35
|
+
export const opTap = (fn) => toPipeFn(opTapSync(fn), opTapAsync(fn));
|
|
36
|
+
//# sourceMappingURL=tap.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type OperatorSync<T, U = T> = (i: Iterable<T>) => Iterable<U>;
|
|
2
|
+
export type OperatorAsync<T, U = T> = (i: AsyncIterable<T>) => AsyncIterable<U>;
|
|
3
|
+
export type OperatorSyncToAsync<T, U = T> = (i: Iterable<T>) => AsyncIterable<U>;
|
|
4
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function opUniqueAsync<T, U>(k?: (v: T) => U): (iter: AsyncIterable<T>) => AsyncIterable<T>;
|
|
2
|
+
export declare function opUniqueSync<T, U>(k?: (v: T) => U): (iter: Iterable<T>) => Iterable<T>;
|
|
3
|
+
export declare const opUnique: <T, U = T>(getKey?: ((v: T) => U) | undefined) => import("../internalTypes.js").PipeFn<T, T>;
|
|
4
|
+
//# sourceMappingURL=unique.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { toPipeFn } from '../helpers/util.js';
|
|
2
|
+
export function opUniqueAsync(k) {
|
|
3
|
+
function fnK(k) {
|
|
4
|
+
async function* fn(iter) {
|
|
5
|
+
const s = new Set();
|
|
6
|
+
for await (const v of iter) {
|
|
7
|
+
const kk = k(v);
|
|
8
|
+
if (s.has(kk))
|
|
9
|
+
continue;
|
|
10
|
+
s.add(kk);
|
|
11
|
+
yield v;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return fn;
|
|
15
|
+
}
|
|
16
|
+
async function* fn(iter) {
|
|
17
|
+
const s = new Set();
|
|
18
|
+
for await (const v of iter) {
|
|
19
|
+
if (s.has(v))
|
|
20
|
+
continue;
|
|
21
|
+
s.add(v);
|
|
22
|
+
yield v;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return k ? fnK(k) : fn;
|
|
26
|
+
}
|
|
27
|
+
export function opUniqueSync(k) {
|
|
28
|
+
function fnK(key) {
|
|
29
|
+
function* fn(iter) {
|
|
30
|
+
const s = new Set();
|
|
31
|
+
for (const v of iter) {
|
|
32
|
+
const kk = key(v);
|
|
33
|
+
if (s.has(kk))
|
|
34
|
+
continue;
|
|
35
|
+
s.add(kk);
|
|
36
|
+
yield v;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return fn;
|
|
40
|
+
}
|
|
41
|
+
function* fn(iter) {
|
|
42
|
+
const s = new Set();
|
|
43
|
+
for (const v of iter) {
|
|
44
|
+
if (s.has(v))
|
|
45
|
+
continue;
|
|
46
|
+
s.add(v);
|
|
47
|
+
yield v;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return k ? fnK(k) : fn;
|
|
51
|
+
}
|
|
52
|
+
export const opUnique = (getKey) => toPipeFn(opUniqueSync(getKey), opUniqueAsync(getKey));
|
|
53
|
+
//# sourceMappingURL=unique.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AnyIterable, PipeAsyncTx, PipeSyncTx } from './internalTypes.js';
|
|
2
|
+
export declare function pipeAsync<T>(i: AnyIterable<T>): AsyncIterable<T>;
|
|
3
|
+
export declare function pipeAsync<T, T0>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0]>): AsyncIterable<T0>;
|
|
4
|
+
export declare function pipeAsync<T, T0, T1>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0, T1]>): AsyncIterable<T1>;
|
|
5
|
+
export declare function pipeAsync<T, T0, T1, T2>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0, T1, T2]>): AsyncIterable<T2>;
|
|
6
|
+
export declare function pipeAsync<T, T0, T1, T2, T3>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0, T1, T2, T3]>): AsyncIterable<T3>;
|
|
7
|
+
export declare function pipeAsync<T, T0, T1, T2, T3, T4>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0, T1, T2, T3, T4]>): AsyncIterable<T4>;
|
|
8
|
+
export declare function pipeAsync<T, T0, T1, T2, T3, T4, T5>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0, T1, T2, T3, T4, T5]>): AsyncIterable<T5>;
|
|
9
|
+
export declare function pipeAsync<T, T0, T1, T2, T3, T4, T5, T6>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0, T1, T2, T3, T4, T5, T6]>): AsyncIterable<T6>;
|
|
10
|
+
export declare function pipeAsync<T, T0, T1, T2, T3, T4, T5, T6, T7>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0, T1, T2, T3, T4, T5, T6, T7]>): AsyncIterable<T7>;
|
|
11
|
+
export declare function pipeSync<T>(i: Iterable<T>): Iterable<T>;
|
|
12
|
+
export declare function pipeSync<T, T0 = T>(i: Iterable<T>, ...f: PipeSyncTx<[T, T0]>): Iterable<T0>;
|
|
13
|
+
export declare function pipeSync<T, T0, T1>(i: Iterable<T>, ...f: PipeSyncTx<[T, T0, T1]>): Iterable<T1>;
|
|
14
|
+
export declare function pipeSync<T, T0, T1, T2>(i: Iterable<T>, ...f: PipeSyncTx<[T, T0, T1, T2]>): Iterable<T2>;
|
|
15
|
+
export declare function pipeSync<T, T0, T1, T2, T3>(i: Iterable<T>, ...f: PipeSyncTx<[T, T0, T1, T2, T3]>): Iterable<T3>;
|
|
16
|
+
export declare function pipeSync<T, T0, T1, T2, T3, T4>(i: Iterable<T>, ...f: PipeSyncTx<[T, T0, T1, T2, T3, T4]>): Iterable<T4>;
|
|
17
|
+
export declare function pipeSync<T, T0, T1, T2, T3, T4, T5>(i: Iterable<T>, ...f: PipeSyncTx<[T, T0, T1, T2, T3, T4, T5]>): Iterable<T5>;
|
|
18
|
+
export declare function pipeSync<T, T0, T1, T2, T3, T4, T5, T6>(i: Iterable<T>, ...f: PipeSyncTx<[T, T0, T1, T2, T3, T4, T5, T6]>): Iterable<T6>;
|
|
19
|
+
export declare function pipeSync<T, T0, T1, T2, T3, T4, T5, T6, T7>(i: Iterable<T>, ...f: PipeSyncTx<[T, T0, T1, T2, T3, T4, T5, T6, T7]>): Iterable<T7>;
|
|
20
|
+
//# sourceMappingURL=pipe.d.ts.map
|
package/dist/esm/pipe.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { toAsyncIterable } from './helpers/index.js';
|
|
2
|
+
import { opCombineAsync, opCombineSync } from './operators/index.js';
|
|
3
|
+
export function pipeAsync(i, ...fns) {
|
|
4
|
+
const iter = toAsyncIterable(i);
|
|
5
|
+
return opCombineAsync(...fns)(iter);
|
|
6
|
+
}
|
|
7
|
+
export function pipeSync(i, ...fns) {
|
|
8
|
+
return opCombineSync(...fns)(i);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=pipe.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AnyIterable } from './internalTypes.js';
|
|
2
|
+
export declare function reduceSync<T>(iter: Iterable<T>, reduceFn: (prev: T, curr: T) => T): T | undefined;
|
|
3
|
+
export declare function reduceSync<T>(iter: Iterable<T>, reduceFn: (prev: T, curr: T) => T, initialValue: T): T;
|
|
4
|
+
export declare function reduceSync<T>(iter: Iterable<T>, reduceFn: (prev: T, curr: T) => T, initialValue?: T): T | undefined;
|
|
5
|
+
export declare function reduceSync<T, U>(iter: Iterable<T>, reduceFn: (prev: U, curr: T) => U, initialValue: U): U;
|
|
6
|
+
export declare function reduceAsync<T>(iter: AnyIterable<T>, reduceFn: (prev: T, curr: T) => T): Promise<T | undefined>;
|
|
7
|
+
export declare function reduceAsync<T>(iter: AnyIterable<T>, reduceFn: (prev: T, curr: T) => T, initialValue: T): Promise<T>;
|
|
8
|
+
export declare function reduceAsync<T>(iter: AnyIterable<T>, reduceFn: (prev: T, curr: T) => T, initialValue?: T): Promise<T | undefined>;
|
|
9
|
+
export declare function reduceAsync<T, U>(iter: AnyIterable<T>, reduceFn: (prev: U, curr: T) => U, initialValue: U): Promise<U>;
|
|
10
|
+
export declare function reduce<T>(iter: Iterable<T>, reduceFn: (prev: T, curr: T) => T): T | undefined;
|
|
11
|
+
export declare function reduce<T>(iter: Iterable<T>, reduceFn: (prev: T, curr: T) => T, initialValue: T): T;
|
|
12
|
+
export declare function reduce<T, U>(iter: Iterable<T>, reduceFn: (prev: U, curr: T) => U, initialValue: U): U;
|
|
13
|
+
export declare function reduce<T>(iter: AsyncIterable<T>, reduceFn: (prev: T, curr: T) => T): Promise<T | undefined>;
|
|
14
|
+
export declare function reduce<T>(iter: AsyncIterable<T>, reduceFn: (prev: T, curr: T) => T, initialValue: T): Promise<T>;
|
|
15
|
+
export declare function reduce<T, U>(iter: AsyncIterable<T>, reduceFn: (prev: U, curr: T) => U, initialValue: U): Promise<U>;
|
|
16
|
+
//# sourceMappingURL=reduce.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isAsyncIterable } from './helpers/index.js';
|
|
2
|
+
import { toArrayAsync } from './helpers/toArray.js';
|
|
3
|
+
import { opReduceAsync, opReduceSync } from './operators/index.js';
|
|
4
|
+
import { pipeAsync, pipeSync } from './pipe.js';
|
|
5
|
+
export function reduceSync(iter, reduceFn, initialValue) {
|
|
6
|
+
const i = initialValue === undefined
|
|
7
|
+
? pipeSync(iter, opReduceSync(reduceFn))
|
|
8
|
+
: pipeSync(iter, opReduceSync(reduceFn, initialValue));
|
|
9
|
+
return [...i][0];
|
|
10
|
+
}
|
|
11
|
+
export async function reduceAsync(iter, reduceFn, initialValue) {
|
|
12
|
+
const i = initialValue === undefined
|
|
13
|
+
? pipeAsync(iter, opReduceAsync(reduceFn))
|
|
14
|
+
: pipeAsync(iter, opReduceAsync(reduceFn, initialValue));
|
|
15
|
+
const arr = await toArrayAsync(i);
|
|
16
|
+
return arr[0];
|
|
17
|
+
}
|
|
18
|
+
export function reduce(iter, reduceFn, initialValue) {
|
|
19
|
+
return isAsyncIterable(iter) ? reduceAsync(iter, reduceFn, initialValue) : reduceSync(iter, reduceFn, initialValue);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=reduce.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { toArraySync as toArray } from '../helpers/toArray.js';
|
|
2
|
+
export type { OperatorSync as Operator } from '../operators/index.js';
|
|
3
|
+
export { opAppendSync as opAppend, opCombineSync as opCombine, opConcatMapSync as opConcatMap, opFilterSync as opFilter, opFirstSync as opFirst, opFlattenSync as opFlatten, opJoinStringsSync as opJoinStrings, opLastSync as opLast, opMapSync as opMap, opReduceSync as opReduce, opSkipSync as opSkip, opTakeSync as opTake, opTapSync as opTap, opUniqueSync as opUnique, } from '../operators/index.js';
|
|
4
|
+
export { pipeSync as pipe, pipeSync } from '../pipe.js';
|
|
5
|
+
export { reduceSync as reduce } from '../reduce.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { toArraySync as toArray } from '../helpers/toArray.js';
|
|
2
|
+
export { opAppendSync as opAppend, opCombineSync as opCombine, opConcatMapSync as opConcatMap, opFilterSync as opFilter, opFirstSync as opFirst, opFlattenSync as opFlatten, opJoinStringsSync as opJoinStrings, opLastSync as opLast, opMapSync as opMap, opReduceSync as opReduce, opSkipSync as opSkip, opTakeSync as opTake, opTapSync as opTap, opUniqueSync as opUnique, } from '../operators/index.js';
|
|
3
|
+
export { pipeSync as pipe, pipeSync } from '../pipe.js';
|
|
4
|
+
export { reduceSync as reduce } from '../reduce.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { toDistributableIterable } from './distribute';
|
|
2
|
-
export { interleave } from './interleave';
|
|
3
|
-
export { asyncIteratorToAsyncIterable, iteratorToIterable } from './iteratorToIterable';
|
|
4
|
-
export { toArray } from './toArray';
|
|
5
|
-
export { toAsyncIterable } from './toAsyncIterable';
|
|
6
|
-
export { isAsyncIterable } from './util';
|
|
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
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyIterable } from '../internalTypes';
|
|
1
|
+
import type { AnyIterable } from '../internalTypes.js';
|
|
2
2
|
export declare function mergeAsyncIterables<T>(iter: Iterable<T>): AsyncIterable<T>;
|
|
3
3
|
export declare function mergeAsyncIterables<T>(iter: AsyncIterable<T>): AsyncIterable<T>;
|
|
4
4
|
export declare function mergeAsyncIterables<T>(iter: Promise<Iterable<T>>): AsyncIterable<T>;
|
package/dist/helpers/util.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyIterable, PipeFn, PipeFnAsync, PipeFnSync } from '../internalTypes';
|
|
1
|
+
import type { AnyIterable, PipeFn, PipeFnAsync, PipeFnSync } from '../internalTypes.js';
|
|
2
2
|
export declare function toPipeFn<T, U = T>(syncFn: PipeFnSync<T, U>, asyncFn: PipeFnAsync<T, U>): PipeFn<T, U>;
|
|
3
3
|
export declare function isAsyncIterable<T>(i: AnyIterable<T>): i is AsyncIterable<T>;
|
|
4
4
|
//# sourceMappingURL=util.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as _helpers from './helpers';
|
|
2
|
-
import * as _operators from './operators';
|
|
3
|
-
export { interleave, isAsyncIterable, toArray, toAsyncIterable, toDistributableIterable } from './helpers';
|
|
4
|
-
export { opAppend, opAwaitAsync, opConcatMap, opFilter, opFirst, opFlatten, opJoinStrings, opLast, opMap, opSkip, opTake, opTap, opUnique, } from './operators';
|
|
5
|
-
export { pipeAsync, pipeSync } from './pipe';
|
|
6
|
-
export { reduce, reduceAsync, reduceSync } from './reduce';
|
|
1
|
+
import * as _helpers from './helpers/index.js';
|
|
2
|
+
import * as _operators from './operators/index.js';
|
|
3
|
+
export { interleave, isAsyncIterable, toArray, toAsyncIterable, toDistributableIterable } from './helpers/index.js';
|
|
4
|
+
export { opAppend, opAwaitAsync, opConcatMap, opFilter, opFirst, opFlatten, opJoinStrings, opLast, opMap, opSkip, opTake, opTap, opUnique, } from './operators/index.js';
|
|
5
|
+
export { pipeAsync, pipeSync } from './pipe.js';
|
|
6
|
+
export { reduce, reduceAsync, reduceSync } from './reduce.js';
|
|
7
7
|
export declare const operators: typeof _operators;
|
|
8
8
|
export declare const helpers: typeof _helpers;
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PaFn, PipeAsyncTx, PipeSyncTx, PsFn } from '../internalTypes';
|
|
2
|
-
import { OperatorAsync, OperatorSync } from './types';
|
|
1
|
+
import type { PaFn, PipeAsyncTx, PipeSyncTx, PsFn } from '../internalTypes.js';
|
|
2
|
+
import type { OperatorAsync, OperatorSync } from './types.js';
|
|
3
3
|
export declare function opCombineAsync<T>(): OperatorAsync<T>;
|
|
4
4
|
export declare function opCombineAsync<T, T0>(...f: PipeAsyncTx<[T, T0]>): OperatorAsync<T0>;
|
|
5
5
|
export declare function opCombineAsync<T, T0, T1>(...f: PipeAsyncTx<[T, T0, T1]>): OperatorAsync<T1>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function opConcatMapAsync<T, U = T>(mapFn: (v: T) => AsyncIterable<U> | Iterable<U>): (iter: AsyncIterable<T>) => AsyncIterable<U>;
|
|
2
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").PipeFn<T, U>;
|
|
3
|
+
export declare const opConcatMap: <T, U>(fn: (v: T) => Iterable<U>) => import("../internalTypes.js").PipeFn<T, U>;
|
|
4
4
|
//# sourceMappingURL=concatMap.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PipeFn } from '../internalTypes';
|
|
1
|
+
import type { PipeFn } from '../internalTypes.js';
|
|
2
2
|
export declare function opFilterAsync<T, S extends T>(filterFn: (v: T) => v is S): (iter: AsyncIterable<T>) => AsyncIterable<S>;
|
|
3
3
|
export declare function opFilterAsync<T, S extends Awaited<T>>(filterFn: (v: Awaited<T>) => v is S): (iter: AsyncIterable<T>) => AsyncIterable<S>;
|
|
4
4
|
export declare function opFilterAsync<T>(filterFn: (v: Awaited<T>) => boolean): (iter: AsyncIterable<T>) => AsyncIterable<Awaited<T>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PipeFn } from '../internalTypes';
|
|
1
|
+
import type { PipeFn } from '../internalTypes.js';
|
|
2
2
|
export declare function opFirstAsync<T, S extends T>(firstFn: (v: T) => v is S): (iter: AsyncIterable<T>) => AsyncIterable<S>;
|
|
3
3
|
export declare function opFirstAsync<T, S extends Awaited<T>>(firstFn: (v: Awaited<T>) => v is S): (iter: AsyncIterable<T>) => AsyncIterable<S>;
|
|
4
4
|
export declare function opFirstAsync<T>(firstFn: (v: Awaited<T>) => boolean): (iter: AsyncIterable<T>) => AsyncIterable<Awaited<T>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function opFlattenAsync<T>(): (iter: AsyncIterable<AsyncIterable<T> | Iterable<T>>) => AsyncIterable<T>;
|
|
2
2
|
export declare function opFlattenSync<T>(): (iter: Iterable<Iterable<T>>) => Iterable<T>;
|
|
3
|
-
export declare const opFlatten: <T>() => import("../internalTypes").PipeFn<Iterable<T>, T>;
|
|
3
|
+
export declare const opFlatten: <T>() => import("../internalTypes.js").PipeFn<Iterable<T>, T>;
|
|
4
4
|
//# sourceMappingURL=flatten.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export { opAppend, opAppendAsync, opAppendSync } from './append';
|
|
2
|
-
export { opAwaitAsync } from './await';
|
|
3
|
-
export { opCombineAsync, opCombineSync } from './combine';
|
|
4
|
-
export { opConcatMap, opConcatMapAsync, opConcatMapSync } from './concatMap';
|
|
5
|
-
export { opFilter, opFilterAsync, opFilterSync } from './filter';
|
|
6
|
-
export { opFirst, opFirstAsync, opFirstSync } from './first';
|
|
7
|
-
export { opFlatten, opFlattenAsync, opFlattenSync } from './flatten';
|
|
8
|
-
export { opJoinStrings, opJoinStringsAsync, opJoinStringsSync } from './joinStrings';
|
|
9
|
-
export { opLast, opLastAsync, opLastSync } from './last';
|
|
10
|
-
export { opMap, opMapAsync, opMapSync } from './map';
|
|
11
|
-
export { opReduceAsync, opReduceSync } from './reduce';
|
|
12
|
-
export { opSkip, opSkipAsync, opSkipSync } from './skip';
|
|
13
|
-
export { opTake, opTakeAsync, opTakeSync } from './take';
|
|
14
|
-
export { opTap, opTapAsync, opTapSync } from './tap';
|
|
15
|
-
export type { OperatorAsync, OperatorSync, OperatorSyncToAsync } from './types';
|
|
16
|
-
export { opUnique, opUniqueAsync, opUniqueSync } from './unique';
|
|
1
|
+
export { opAppend, opAppendAsync, opAppendSync } from './append.js';
|
|
2
|
+
export { opAwaitAsync } from './await.js';
|
|
3
|
+
export { opCombineAsync, opCombineSync } from './combine.js';
|
|
4
|
+
export { opConcatMap, opConcatMapAsync, opConcatMapSync } from './concatMap.js';
|
|
5
|
+
export { opFilter, opFilterAsync, opFilterSync } from './filter.js';
|
|
6
|
+
export { opFirst, opFirstAsync, opFirstSync } from './first.js';
|
|
7
|
+
export { opFlatten, opFlattenAsync, opFlattenSync } from './flatten.js';
|
|
8
|
+
export { opJoinStrings, opJoinStringsAsync, opJoinStringsSync } from './joinStrings.js';
|
|
9
|
+
export { opLast, opLastAsync, opLastSync } from './last.js';
|
|
10
|
+
export { opMap, opMapAsync, opMapSync } from './map.js';
|
|
11
|
+
export { opReduceAsync, opReduceSync } from './reduce.js';
|
|
12
|
+
export { opSkip, opSkipAsync, opSkipSync } from './skip.js';
|
|
13
|
+
export { opTake, opTakeAsync, opTakeSync } from './take.js';
|
|
14
|
+
export { opTap, opTapAsync, opTapSync } from './tap.js';
|
|
15
|
+
export type { OperatorAsync, OperatorSync, OperatorSyncToAsync } from './types.js';
|
|
16
|
+
export { opUnique, opUniqueAsync, opUniqueSync } from './unique.js';
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function opJoinStringsAsync(joinCharacter?: string): (iter: AsyncIterable<AsyncIterable<string> | Iterable<string>>) => AsyncIterable<string>;
|
|
2
2
|
export declare function opJoinStringsSync(joinCharacter?: string): (iter: Iterable<Iterable<string>>) => Iterable<string>;
|
|
3
|
-
export declare const opJoinStrings: (joinCharacter?: string) => import("../internalTypes").PipeFn<Iterable<string>, string>;
|
|
3
|
+
export declare const opJoinStrings: (joinCharacter?: string) => import("../internalTypes.js").PipeFn<Iterable<string>, string>;
|
|
4
4
|
//# sourceMappingURL=joinStrings.d.ts.map
|
package/dist/operators/last.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PipeFn } from '../internalTypes';
|
|
1
|
+
import type { PipeFn } from '../internalTypes.js';
|
|
2
2
|
export declare function opLastAsync<T, S extends T>(lastFn: (v: T) => v is S): (iter: AsyncIterable<T>) => AsyncIterable<S>;
|
|
3
3
|
export declare function opLastAsync<T, S extends Awaited<T>>(lastFn: (v: Awaited<T>) => v is S): (iter: AsyncIterable<T>) => AsyncIterable<S>;
|
|
4
4
|
export declare function opLastAsync<T>(lastFn: (v: Awaited<T>) => boolean): (iter: AsyncIterable<T>) => AsyncIterable<Awaited<T>>;
|
package/dist/operators/map.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function opMapAsync<T, U = T>(mapFn: (v: T) => U): (iter: AsyncIterable<T>) => AsyncIterable<U>;
|
|
2
2
|
export declare function opMapSync<T, U = T>(mapFn: (v: T) => U): (iter: Iterable<T>) => Iterable<U>;
|
|
3
|
-
export declare const opMap: <T, U>(fn: (v: T) => U) => import("../internalTypes").PipeFn<T, U>;
|
|
3
|
+
export declare const opMap: <T, U>(fn: (v: T) => U) => import("../internalTypes.js").PipeFn<T, U>;
|
|
4
4
|
//# sourceMappingURL=map.d.ts.map
|
package/dist/operators/skip.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function opSkipAsync<T>(count: number): (iter: AsyncIterable<T> | Iterable<T>) => AsyncIterable<T>;
|
|
2
2
|
export declare function opSkipSync<T>(count: number): (iter: Iterable<T>) => Iterable<T>;
|
|
3
|
-
export declare const opSkip: <T>(count: number) => import("../internalTypes").PipeFn<T, T>;
|
|
3
|
+
export declare const opSkip: <T>(count: number) => import("../internalTypes.js").PipeFn<T, T>;
|
|
4
4
|
//# sourceMappingURL=skip.d.ts.map
|
package/dist/operators/take.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export declare function opTakeSync<T>(count: number): (iter: Iterable<T>) => Ite
|
|
|
4
4
|
* Consume only the first `count` number from the iterable.
|
|
5
5
|
* @param count - number to take
|
|
6
6
|
*/
|
|
7
|
-
export declare const opTake: <T>(count: number) => import("../internalTypes").PipeFn<T, T>;
|
|
7
|
+
export declare const opTake: <T>(count: number) => import("../internalTypes.js").PipeFn<T, T>;
|
|
8
8
|
//# sourceMappingURL=take.d.ts.map
|
package/dist/operators/tap.d.ts
CHANGED
|
@@ -15,5 +15,5 @@ export declare function opTapSync<T>(tapFn: (v: T) => void): (iter: Iterable<T>)
|
|
|
15
15
|
*
|
|
16
16
|
* @param fn - function to call for each value.
|
|
17
17
|
*/
|
|
18
|
-
export declare const opTap: <T>(fn: (v: T) => void) => import("../internalTypes").PipeFn<T, T>;
|
|
18
|
+
export declare const opTap: <T>(fn: (v: T) => void) => import("../internalTypes.js").PipeFn<T, T>;
|
|
19
19
|
//# sourceMappingURL=tap.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function opUniqueAsync<T, U>(k?: (v: T) => U): (iter: AsyncIterable<T>) => AsyncIterable<T>;
|
|
2
2
|
export declare function opUniqueSync<T, U>(k?: (v: T) => U): (iter: Iterable<T>) => Iterable<T>;
|
|
3
|
-
export declare const opUnique: <T, U = T>(getKey?: ((v: T) => U) | undefined) => import("../internalTypes").PipeFn<T, T>;
|
|
3
|
+
export declare const opUnique: <T, U = T>(getKey?: ((v: T) => U) | undefined) => import("../internalTypes.js").PipeFn<T, T>;
|
|
4
4
|
//# sourceMappingURL=unique.d.ts.map
|
package/dist/pipe.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyIterable, PipeAsyncTx, PipeSyncTx } from './internalTypes';
|
|
1
|
+
import type { AnyIterable, PipeAsyncTx, PipeSyncTx } from './internalTypes.js';
|
|
2
2
|
export declare function pipeAsync<T>(i: AnyIterable<T>): AsyncIterable<T>;
|
|
3
3
|
export declare function pipeAsync<T, T0>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0]>): AsyncIterable<T0>;
|
|
4
4
|
export declare function pipeAsync<T, T0, T1>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0, T1]>): AsyncIterable<T1>;
|
package/dist/reduce.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyIterable } from './internalTypes';
|
|
1
|
+
import type { AnyIterable } from './internalTypes.js';
|
|
2
2
|
export declare function reduceSync<T>(iter: Iterable<T>, reduceFn: (prev: T, curr: T) => T): T | undefined;
|
|
3
3
|
export declare function reduceSync<T>(iter: Iterable<T>, reduceFn: (prev: T, curr: T) => T, initialValue: T): T;
|
|
4
4
|
export declare function reduceSync<T>(iter: Iterable<T>, reduceFn: (prev: T, curr: T) => T, initialValue?: T): T | undefined;
|
package/dist/sync/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { toArraySync as toArray } from '../helpers/toArray';
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
4
|
-
export { pipeSync as pipe, pipeSync } from '../pipe';
|
|
5
|
-
export { reduceSync as reduce } from '../reduce';
|
|
1
|
+
export { toArraySync as toArray } from '../helpers/toArray.js';
|
|
2
|
+
export type { OperatorSync as Operator } from '../operators/index.js';
|
|
3
|
+
export { opAppendSync as opAppend, opCombineSync as opCombine, opConcatMapSync as opConcatMap, opFilterSync as opFilter, opFirstSync as opFirst, opFlattenSync as opFlatten, opJoinStringsSync as opJoinStrings, opLastSync as opLast, opMapSync as opMap, opReduceSync as opReduce, opSkipSync as opSkip, opTakeSync as opTake, opTapSync as opTap, opUniqueSync as opUnique, } from '../operators/index.js';
|
|
4
|
+
export { pipeSync as pipe, pipeSync } from '../pipe.js';
|
|
5
|
+
export { reduceSync as reduce } from '../reduce.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "6.
|
|
6
|
+
"version": "6.19.0",
|
|
7
7
|
"description": "Library to make working with Iterators/AsyncIterators easier.",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"cspell",
|
|
@@ -16,42 +16,59 @@
|
|
|
16
16
|
"author": "Jason Dent <jason@streetsidesoftware.nl>",
|
|
17
17
|
"homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-pipe#readme",
|
|
18
18
|
"license": "MIT",
|
|
19
|
-
"
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "dist/cjs/index.cjs",
|
|
21
|
+
"module": "dist/esm/index.js",
|
|
20
22
|
"directories": {
|
|
21
23
|
"dist": "dist"
|
|
22
24
|
},
|
|
23
25
|
"exports": {
|
|
24
26
|
".": {
|
|
25
|
-
"
|
|
27
|
+
"import": "./dist/esm/index.js",
|
|
28
|
+
"require": "./dist/cjs/index.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./index": {
|
|
31
|
+
"import": "./dist/esm/index.js",
|
|
32
|
+
"require": "./dist/cjs/index.cjs"
|
|
33
|
+
},
|
|
34
|
+
"./index.js": {
|
|
35
|
+
"import": "./dist/esm/index.js",
|
|
36
|
+
"require": "./dist/cjs/index.cjs"
|
|
37
|
+
},
|
|
38
|
+
"./index.d.ts": {
|
|
39
|
+
"import": "./dist/esm/index.d.ts",
|
|
40
|
+
"require": "./dist/cjs/index.d.ts"
|
|
26
41
|
},
|
|
27
|
-
"./index": "./dist/index.js",
|
|
28
|
-
"./index.js": "./dist/index.js",
|
|
29
|
-
"./index.d.ts": "./dist/index.d.ts",
|
|
30
42
|
"./operators": {
|
|
31
|
-
"
|
|
43
|
+
"import": "./dist/esm/operators/index.js",
|
|
44
|
+
"require": "./dist/cjs/operators/index.cjs"
|
|
32
45
|
},
|
|
33
46
|
"./operators/index.js": {
|
|
34
|
-
"
|
|
47
|
+
"import": "./dist/esm/operators/index.js",
|
|
48
|
+
"require": "./dist/cjs/operators/index.cjs"
|
|
35
49
|
},
|
|
36
50
|
"./operators/index.d.ts": {
|
|
37
|
-
"
|
|
51
|
+
"import": "./dist/esm/operators/index.d.ts",
|
|
52
|
+
"require": "./dist/cjs/operators/index.d.ts"
|
|
38
53
|
},
|
|
39
54
|
"./sync": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"default": "./dist/sync/index.js"
|
|
55
|
+
"import": "./dist/esm/sync/index.js",
|
|
56
|
+
"require": "./dist/cjs/sync/index.cjs"
|
|
43
57
|
},
|
|
44
58
|
"./sync/index": {
|
|
45
|
-
"
|
|
59
|
+
"import": "./dist/esm/sync/index.js",
|
|
60
|
+
"require": "./dist/cjs/sync/index.cjs"
|
|
46
61
|
},
|
|
47
62
|
"./sync/index.js": {
|
|
48
|
-
"
|
|
63
|
+
"import": "./dist/esm/sync/index.js",
|
|
64
|
+
"require": "./dist/cjs/sync/index.cjs"
|
|
49
65
|
},
|
|
50
66
|
"./sync/index.d.ts": {
|
|
51
|
-
"
|
|
67
|
+
"import": "./dist/esm/sync/index.d.ts",
|
|
68
|
+
"require": "./dist/cjs/sync/index.d.ts"
|
|
52
69
|
}
|
|
53
70
|
},
|
|
54
|
-
"
|
|
71
|
+
"types": "dist/index.d.ts",
|
|
55
72
|
"typesVersions": {
|
|
56
73
|
"*": {
|
|
57
74
|
"index.d.ts": [
|
|
@@ -75,8 +92,11 @@
|
|
|
75
92
|
"sync/index.d.ts": [
|
|
76
93
|
"dist/sync/index.d.ts"
|
|
77
94
|
],
|
|
95
|
+
"dist/cjs/index.d.ts": [
|
|
96
|
+
"dist/index.d.ts"
|
|
97
|
+
],
|
|
78
98
|
"*": [
|
|
79
|
-
"dist
|
|
99
|
+
"dist/*.d.ts",
|
|
80
100
|
"dist/*/index.d.ts"
|
|
81
101
|
]
|
|
82
102
|
}
|
|
@@ -90,14 +110,19 @@
|
|
|
90
110
|
"!**/*.map"
|
|
91
111
|
],
|
|
92
112
|
"scripts": {
|
|
93
|
-
"build": "
|
|
113
|
+
"build": "pnpm build:types && pnpm build:esm && pnpm build:cjs",
|
|
114
|
+
"build:cjs": "rollup -c rollup.config.mjs",
|
|
115
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
116
|
+
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist",
|
|
94
117
|
"build-dev": "tsc -p tsconfig.dev.json",
|
|
95
118
|
"watch": "tsc -p . -w",
|
|
96
|
-
"clean": "
|
|
119
|
+
"clean": "shx rm -rf dist coverage .tsbuildinfo",
|
|
97
120
|
"clean-build": "pnpm run clean && pnpm run build",
|
|
98
|
-
"coverage": "
|
|
99
|
-
"
|
|
100
|
-
"
|
|
121
|
+
"coverage": "pnpm coverage:vitest && pnpm coverage:fix",
|
|
122
|
+
"coverage:vitest": "vitest run --coverage",
|
|
123
|
+
"coverage:fix": "nyc report --temp-dir \"$(pwd)/coverage\" --reporter lcov --report-dir \"$(pwd)/coverage\" --cwd ../..",
|
|
124
|
+
"test-watch": "vitest",
|
|
125
|
+
"test": "vitest run"
|
|
101
126
|
},
|
|
102
127
|
"repository": {
|
|
103
128
|
"type": "git",
|
|
@@ -110,9 +135,18 @@
|
|
|
110
135
|
"node": ">=14"
|
|
111
136
|
},
|
|
112
137
|
"devDependencies": {
|
|
113
|
-
"@
|
|
138
|
+
"@rollup/plugin-commonjs": "^24.0.0",
|
|
139
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
140
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
141
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
142
|
+
"@types/node": "^18.11.18",
|
|
143
|
+
"globby": "^13.1.3",
|
|
114
144
|
"jest": "^29.3.1",
|
|
115
|
-
"
|
|
145
|
+
"rollup": "^3.10.0",
|
|
146
|
+
"tslib": "^2.4.1"
|
|
147
|
+
},
|
|
148
|
+
"dependencies": {
|
|
149
|
+
"vitest": "^0.26.3"
|
|
116
150
|
},
|
|
117
|
-
"gitHead": "
|
|
151
|
+
"gitHead": "f643f0cd6384905618dbca950bd65a39a77dc028"
|
|
118
152
|
}
|
package/dist/helpers/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAsyncIterable = exports.toAsyncIterable = exports.toArray = exports.iteratorToIterable = exports.asyncIteratorToAsyncIterable = exports.interleave = exports.toDistributableIterable = void 0;
|
|
4
|
-
var distribute_1 = require("./distribute");
|
|
5
|
-
Object.defineProperty(exports, "toDistributableIterable", { enumerable: true, get: function () { return distribute_1.toDistributableIterable; } });
|
|
6
|
-
var interleave_1 = require("./interleave");
|
|
7
|
-
Object.defineProperty(exports, "interleave", { enumerable: true, get: function () { return interleave_1.interleave; } });
|
|
8
|
-
var iteratorToIterable_1 = require("./iteratorToIterable");
|
|
9
|
-
Object.defineProperty(exports, "asyncIteratorToAsyncIterable", { enumerable: true, get: function () { return iteratorToIterable_1.asyncIteratorToAsyncIterable; } });
|
|
10
|
-
Object.defineProperty(exports, "iteratorToIterable", { enumerable: true, get: function () { return iteratorToIterable_1.iteratorToIterable; } });
|
|
11
|
-
var toArray_1 = require("./toArray");
|
|
12
|
-
Object.defineProperty(exports, "toArray", { enumerable: true, get: function () { return toArray_1.toArray; } });
|
|
13
|
-
var toAsyncIterable_1 = require("./toAsyncIterable");
|
|
14
|
-
Object.defineProperty(exports, "toAsyncIterable", { enumerable: true, get: function () { return toAsyncIterable_1.toAsyncIterable; } });
|
|
15
|
-
var util_1 = require("./util");
|
|
16
|
-
Object.defineProperty(exports, "isAsyncIterable", { enumerable: true, get: function () { return util_1.isAsyncIterable; } });
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.asyncIteratorToAsyncIterable = exports.iteratorToIterable = void 0;
|
|
4
|
-
function* iteratorToIterable(iterator) {
|
|
5
|
-
let n;
|
|
6
|
-
while (!(n = iterator.next()).done) {
|
|
7
|
-
yield n.value;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.iteratorToIterable = iteratorToIterable;
|
|
11
|
-
async function* asyncIteratorToAsyncIterable(iterator) {
|
|
12
|
-
let n;
|
|
13
|
-
while (!(n = await iterator.next()).done) {
|
|
14
|
-
yield n.value;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.asyncIteratorToAsyncIterable = asyncIteratorToAsyncIterable;
|
|
18
|
-
//# sourceMappingURL=iteratorToIterable.js.map
|