@cspell/cspell-pipe 8.7.0 → 8.8.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/async/index.d.ts +6 -0
- package/dist/async/index.js +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/operators/buffer.d.ts +14 -0
- package/dist/operators/buffer.js +51 -0
- package/dist/operators/index.d.ts +1 -0
- package/dist/operators/index.js +1 -0
- package/dist/sync/index.d.ts +1 -1
- package/dist/sync/index.js +1 -1
- package/package.json +11 -2
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { toArrayAsync as toArray } from '../helpers/toArray.js';
|
|
2
|
+
export type { OperatorAsync as Operator } from '../operators/index.js';
|
|
3
|
+
export { opAppendAsync as opAppend, opBufferAsync as opBuffer, opCombineAsync as opCombine, opConcatMapAsync as opConcatMap, opFilterAsync as opFilter, opFirstAsync as opFirst, opFlattenAsync as opFlatten, opJoinStringsAsync as opJoinStrings, opLastAsync as opLast, opMapAsync as opMap, opReduceAsync as opReduce, opSkipAsync as opSkip, opTakeAsync as opTake, opTapAsync as opTap, opUniqueAsync as opUnique, } from '../operators/index.js';
|
|
4
|
+
export { pipeAsync as pipe, pipeAsync } from '../pipe.js';
|
|
5
|
+
export { reduceAsync as reduce } from '../reduce.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { toArrayAsync as toArray } from '../helpers/toArray.js';
|
|
2
|
+
export { opAppendAsync as opAppend, opBufferAsync as opBuffer, opCombineAsync as opCombine, opConcatMapAsync as opConcatMap, opFilterAsync as opFilter, opFirstAsync as opFirst, opFlattenAsync as opFlatten, opJoinStringsAsync as opJoinStrings, opLastAsync as opLast, opMapAsync as opMap, opReduceAsync as opReduce, opSkipAsync as opSkip, opTakeAsync as opTake, opTapAsync as opTap, opUniqueAsync as opUnique, } from '../operators/index.js';
|
|
3
|
+
export { pipeAsync as pipe, pipeAsync } from '../pipe.js';
|
|
4
|
+
export { reduceAsync as reduce } from '../reduce.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _helpers from './helpers/index.js';
|
|
2
2
|
import * as _operators from './operators/index.js';
|
|
3
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';
|
|
4
|
+
export { opAppend, opAwaitAsync, opBuffer, opConcatMap, opFilter, opFirst, opFlatten, opJoinStrings, opLast, opMap, opSkip, opTake, opTap, opUnique, } from './operators/index.js';
|
|
5
5
|
export { pipeAsync, pipeSync } from './pipe.js';
|
|
6
6
|
export { reduce, reduceAsync, reduceSync } from './reduce.js';
|
|
7
7
|
export declare const operators: typeof _operators;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _helpers from './helpers/index.js';
|
|
2
2
|
import * as _operators from './operators/index.js';
|
|
3
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';
|
|
4
|
+
export { opAppend, opAwaitAsync, opBuffer, opConcatMap, opFilter, opFirst, opFlatten, opJoinStrings, opLast, opMap, opSkip, opTake, opTap, opUnique, } from './operators/index.js';
|
|
5
5
|
export { pipeAsync, pipeSync } from './pipe.js';
|
|
6
6
|
export { reduce, reduceAsync, reduceSync } from './reduce.js';
|
|
7
7
|
// eslint-disable-next-line unicorn/prefer-export-from
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PipeFn } from '../internalTypes.js';
|
|
2
|
+
/**
|
|
3
|
+
* Buffer the input iterable into arrays of the given size.
|
|
4
|
+
* @param size - The size of the buffer.
|
|
5
|
+
* @returns A function that takes an async iterable and returns an async iterable of arrays of the given size.
|
|
6
|
+
*/
|
|
7
|
+
export declare function opBufferAsync<T>(size: number): (iter: AsyncIterable<T>) => AsyncIterable<T[]>;
|
|
8
|
+
/**
|
|
9
|
+
* @param size - The size of the buffer.
|
|
10
|
+
* @returns A function that takes an iterable and returns an iterable of arrays of the given size.
|
|
11
|
+
*/
|
|
12
|
+
export declare function opBufferSync<T>(size: number): (iter: Iterable<T>) => Iterable<T[]>;
|
|
13
|
+
export declare function opBuffer<T>(size: number): PipeFn<T, T[]>;
|
|
14
|
+
//# sourceMappingURL=buffer.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { isAsyncIterable } from '../helpers/util.js';
|
|
2
|
+
/**
|
|
3
|
+
* Buffer the input iterable into arrays of the given size.
|
|
4
|
+
* @param size - The size of the buffer.
|
|
5
|
+
* @returns A function that takes an async iterable and returns an async iterable of arrays of the given size.
|
|
6
|
+
*/
|
|
7
|
+
export function opBufferAsync(size) {
|
|
8
|
+
async function* fn(iter) {
|
|
9
|
+
let buffer = [];
|
|
10
|
+
for await (const v of iter) {
|
|
11
|
+
buffer.push(v);
|
|
12
|
+
if (buffer.length >= size) {
|
|
13
|
+
yield buffer;
|
|
14
|
+
buffer = [];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (buffer.length > 0) {
|
|
18
|
+
yield buffer;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return fn;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @param size - The size of the buffer.
|
|
25
|
+
* @returns A function that takes an iterable and returns an iterable of arrays of the given size.
|
|
26
|
+
*/
|
|
27
|
+
export function opBufferSync(size) {
|
|
28
|
+
function* fn(iter) {
|
|
29
|
+
let buffer = [];
|
|
30
|
+
for (const v of iter) {
|
|
31
|
+
buffer.push(v);
|
|
32
|
+
if (buffer.length >= size) {
|
|
33
|
+
yield buffer;
|
|
34
|
+
buffer = [];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (buffer.length > 0) {
|
|
38
|
+
yield buffer;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return fn;
|
|
42
|
+
}
|
|
43
|
+
export function opBuffer(size) {
|
|
44
|
+
const asyncFn = opBufferAsync(size);
|
|
45
|
+
const syncFn = opBufferSync(size);
|
|
46
|
+
function _(i) {
|
|
47
|
+
return isAsyncIterable(i) ? asyncFn(i) : syncFn(i);
|
|
48
|
+
}
|
|
49
|
+
return _;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=buffer.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { opAppend, opAppendAsync, opAppendSync } from './append.js';
|
|
2
2
|
export { opAwaitAsync } from './await.js';
|
|
3
|
+
export { opBuffer, opBufferAsync, opBufferSync } from './buffer.js';
|
|
3
4
|
export { opCombineAsync, opCombineSync } from './combine.js';
|
|
4
5
|
export { opConcatMap, opConcatMapAsync, opConcatMapSync } from './concatMap.js';
|
|
5
6
|
export { opFilter, opFilterAsync, opFilterSync } from './filter.js';
|
package/dist/operators/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { opAppend, opAppendAsync, opAppendSync } from './append.js';
|
|
2
2
|
export { opAwaitAsync } from './await.js';
|
|
3
|
+
export { opBuffer, opBufferAsync, opBufferSync } from './buffer.js';
|
|
3
4
|
export { opCombineAsync, opCombineSync } from './combine.js';
|
|
4
5
|
export { opConcatMap, opConcatMapAsync, opConcatMapSync } from './concatMap.js';
|
|
5
6
|
export { opFilter, opFilterAsync, opFilterSync } from './filter.js';
|
package/dist/sync/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { toArraySync as toArray } from '../helpers/toArray.js';
|
|
2
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';
|
|
3
|
+
export { opAppendSync as opAppend, opBufferSync as opBuffer, 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
4
|
export { pipeSync as pipe, pipeSync } from '../pipe.js';
|
|
5
5
|
export { reduceSync as reduce } from '../reduce.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/sync/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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';
|
|
2
|
+
export { opAppendSync as opAppend, opBufferSync as opBuffer, 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
3
|
export { pipeSync as pipe, pipeSync } from '../pipe.js';
|
|
4
4
|
export { reduceSync as reduce } from '../reduce.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "8.
|
|
6
|
+
"version": "8.8.0",
|
|
7
7
|
"description": "Library to make working with Iterators/AsyncIterators easier.",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"cspell",
|
|
@@ -39,6 +39,15 @@
|
|
|
39
39
|
"./operators/index.js": {
|
|
40
40
|
"import": "./dist/operators/index.js"
|
|
41
41
|
},
|
|
42
|
+
"./async": {
|
|
43
|
+
"import": "./dist/async/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./async/index": {
|
|
46
|
+
"import": "./dist/async/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./async/index.js": {
|
|
49
|
+
"import": "./dist/async/index.js"
|
|
50
|
+
},
|
|
42
51
|
"./sync": {
|
|
43
52
|
"import": "./dist/sync/index.js"
|
|
44
53
|
},
|
|
@@ -117,5 +126,5 @@
|
|
|
117
126
|
"devDependencies": {
|
|
118
127
|
"globby": "^14.0.1"
|
|
119
128
|
},
|
|
120
|
-
"gitHead": "
|
|
129
|
+
"gitHead": "a42bce675c00cb2d51809b3ae3894119ea4f5ce7"
|
|
121
130
|
}
|