@cspell/cspell-pipe 5.18.3 → 5.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/index.d.ts +1 -1
- package/dist/index.js +10 -2
- package/dist/operators/concatMap.d.ts +4 -0
- package/dist/operators/concatMap.js +25 -0
- package/dist/operators/index.d.ts +4 -0
- package/dist/operators/index.js +17 -1
- package/dist/operators/skip.d.ts +4 -0
- package/dist/operators/skip.js +33 -0
- package/dist/operators/take.d.ts +4 -0
- package/dist/operators/take.js +33 -0
- package/dist/operators/tap.d.ts +19 -0
- package/dist/operators/tap.js +42 -0
- package/package.json +6 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _helpers from './helpers';
|
|
2
2
|
import * as _operators from './operators';
|
|
3
3
|
export { isAsyncIterable, toArray, toAsyncIterable } from './helpers';
|
|
4
|
-
export { opAwaitAsync, opFilter, opFlatten, opJoinStrings, opMap, opUnique } from './operators';
|
|
4
|
+
export { opAwaitAsync, opConcatMap, opFilter, opFlatten, opJoinStrings, opMap, opSkip, opTake, opTap, opUnique, } from './operators';
|
|
5
5
|
export { pipeAsync, pipeSync } from './pipe';
|
|
6
6
|
export declare const operators: typeof _operators;
|
|
7
7
|
export declare const helpers: typeof _helpers;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -19,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
23
|
return result;
|
|
20
24
|
};
|
|
21
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.helpers = exports.operators = exports.pipeSync = exports.pipeAsync = exports.opUnique = exports.opMap = exports.opJoinStrings = exports.opFlatten = exports.opFilter = exports.opAwaitAsync = exports.toAsyncIterable = exports.toArray = exports.isAsyncIterable = void 0;
|
|
26
|
+
exports.helpers = exports.operators = exports.pipeSync = exports.pipeAsync = exports.opUnique = exports.opTap = exports.opTake = exports.opSkip = exports.opMap = exports.opJoinStrings = exports.opFlatten = exports.opFilter = exports.opConcatMap = exports.opAwaitAsync = exports.toAsyncIterable = exports.toArray = exports.isAsyncIterable = void 0;
|
|
23
27
|
const _helpers = __importStar(require("./helpers"));
|
|
24
28
|
const _operators = __importStar(require("./operators"));
|
|
25
29
|
var helpers_1 = require("./helpers");
|
|
@@ -28,10 +32,14 @@ Object.defineProperty(exports, "toArray", { enumerable: true, get: function () {
|
|
|
28
32
|
Object.defineProperty(exports, "toAsyncIterable", { enumerable: true, get: function () { return helpers_1.toAsyncIterable; } });
|
|
29
33
|
var operators_1 = require("./operators");
|
|
30
34
|
Object.defineProperty(exports, "opAwaitAsync", { enumerable: true, get: function () { return operators_1.opAwaitAsync; } });
|
|
35
|
+
Object.defineProperty(exports, "opConcatMap", { enumerable: true, get: function () { return operators_1.opConcatMap; } });
|
|
31
36
|
Object.defineProperty(exports, "opFilter", { enumerable: true, get: function () { return operators_1.opFilter; } });
|
|
32
37
|
Object.defineProperty(exports, "opFlatten", { enumerable: true, get: function () { return operators_1.opFlatten; } });
|
|
33
38
|
Object.defineProperty(exports, "opJoinStrings", { enumerable: true, get: function () { return operators_1.opJoinStrings; } });
|
|
34
39
|
Object.defineProperty(exports, "opMap", { enumerable: true, get: function () { return operators_1.opMap; } });
|
|
40
|
+
Object.defineProperty(exports, "opSkip", { enumerable: true, get: function () { return operators_1.opSkip; } });
|
|
41
|
+
Object.defineProperty(exports, "opTake", { enumerable: true, get: function () { return operators_1.opTake; } });
|
|
42
|
+
Object.defineProperty(exports, "opTap", { enumerable: true, get: function () { return operators_1.opTap; } });
|
|
35
43
|
Object.defineProperty(exports, "opUnique", { enumerable: true, get: function () { return operators_1.opUnique; } });
|
|
36
44
|
var pipe_1 = require("./pipe");
|
|
37
45
|
Object.defineProperty(exports, "pipeAsync", { enumerable: true, get: function () { return pipe_1.pipeAsync; } });
|
|
@@ -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").PipeFn<T, U>;
|
|
4
|
+
//# sourceMappingURL=concatMap.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.opConcatMap = exports.opConcatMapSync = exports.opConcatMapAsync = void 0;
|
|
4
|
+
const util_1 = require("../helpers/util");
|
|
5
|
+
function opConcatMapAsync(mapFn) {
|
|
6
|
+
async function* fn(iter) {
|
|
7
|
+
for await (const v of iter) {
|
|
8
|
+
yield* mapFn(v);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return fn;
|
|
12
|
+
}
|
|
13
|
+
exports.opConcatMapAsync = opConcatMapAsync;
|
|
14
|
+
function opConcatMapSync(mapFn) {
|
|
15
|
+
function* fn(iter) {
|
|
16
|
+
for (const v of iter) {
|
|
17
|
+
yield* mapFn(v);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return fn;
|
|
21
|
+
}
|
|
22
|
+
exports.opConcatMapSync = opConcatMapSync;
|
|
23
|
+
const opConcatMap = (fn) => (0, util_1.toPipeFn)(opConcatMapSync(fn), opConcatMapAsync(fn));
|
|
24
|
+
exports.opConcatMap = opConcatMap;
|
|
25
|
+
//# sourceMappingURL=concatMap.js.map
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export { opAwaitAsync } from './await';
|
|
2
|
+
export { opConcatMap, opConcatMapAsync, opConcatMapSync } from './concatMap';
|
|
2
3
|
export { opFilter as opFilter, opFilterAsync, opFilterSync } from './filter';
|
|
3
4
|
export { opFlatten, opFlattenAsync, opFlattenSync } from './flatten';
|
|
4
5
|
export { opJoinStrings, opJoinStringsAsync, opJoinStringsSync } from './joinStrings';
|
|
5
6
|
export { opMap, opMapAsync, opMapSync } from './map';
|
|
7
|
+
export { opSkip, opSkipAsync, opSkipSync } from './skip';
|
|
8
|
+
export { opTake, opTakeAsync, opTakeSync } from './take';
|
|
9
|
+
export { opTap, opTapAsync, opTapSync } from './tap';
|
|
6
10
|
export { opUnique, opUniqueAsync, opUniqueSync } from './unique';
|
|
7
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/operators/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.opUniqueSync = exports.opUniqueAsync = exports.opUnique = exports.opMapSync = exports.opMapAsync = exports.opMap = exports.opJoinStringsSync = exports.opJoinStringsAsync = exports.opJoinStrings = exports.opFlattenSync = exports.opFlattenAsync = exports.opFlatten = exports.opFilterSync = exports.opFilterAsync = exports.opFilter = exports.opAwaitAsync = void 0;
|
|
3
|
+
exports.opUniqueSync = exports.opUniqueAsync = exports.opUnique = exports.opTapSync = exports.opTapAsync = exports.opTap = exports.opTakeSync = exports.opTakeAsync = exports.opTake = exports.opSkipSync = exports.opSkipAsync = exports.opSkip = exports.opMapSync = exports.opMapAsync = exports.opMap = exports.opJoinStringsSync = exports.opJoinStringsAsync = exports.opJoinStrings = exports.opFlattenSync = exports.opFlattenAsync = exports.opFlatten = exports.opFilterSync = exports.opFilterAsync = exports.opFilter = exports.opConcatMapSync = exports.opConcatMapAsync = exports.opConcatMap = exports.opAwaitAsync = void 0;
|
|
4
4
|
var await_1 = require("./await");
|
|
5
5
|
Object.defineProperty(exports, "opAwaitAsync", { enumerable: true, get: function () { return await_1.opAwaitAsync; } });
|
|
6
|
+
var concatMap_1 = require("./concatMap");
|
|
7
|
+
Object.defineProperty(exports, "opConcatMap", { enumerable: true, get: function () { return concatMap_1.opConcatMap; } });
|
|
8
|
+
Object.defineProperty(exports, "opConcatMapAsync", { enumerable: true, get: function () { return concatMap_1.opConcatMapAsync; } });
|
|
9
|
+
Object.defineProperty(exports, "opConcatMapSync", { enumerable: true, get: function () { return concatMap_1.opConcatMapSync; } });
|
|
6
10
|
var filter_1 = require("./filter");
|
|
7
11
|
Object.defineProperty(exports, "opFilter", { enumerable: true, get: function () { return filter_1.opFilter; } });
|
|
8
12
|
Object.defineProperty(exports, "opFilterAsync", { enumerable: true, get: function () { return filter_1.opFilterAsync; } });
|
|
@@ -19,6 +23,18 @@ var map_1 = require("./map");
|
|
|
19
23
|
Object.defineProperty(exports, "opMap", { enumerable: true, get: function () { return map_1.opMap; } });
|
|
20
24
|
Object.defineProperty(exports, "opMapAsync", { enumerable: true, get: function () { return map_1.opMapAsync; } });
|
|
21
25
|
Object.defineProperty(exports, "opMapSync", { enumerable: true, get: function () { return map_1.opMapSync; } });
|
|
26
|
+
var skip_1 = require("./skip");
|
|
27
|
+
Object.defineProperty(exports, "opSkip", { enumerable: true, get: function () { return skip_1.opSkip; } });
|
|
28
|
+
Object.defineProperty(exports, "opSkipAsync", { enumerable: true, get: function () { return skip_1.opSkipAsync; } });
|
|
29
|
+
Object.defineProperty(exports, "opSkipSync", { enumerable: true, get: function () { return skip_1.opSkipSync; } });
|
|
30
|
+
var take_1 = require("./take");
|
|
31
|
+
Object.defineProperty(exports, "opTake", { enumerable: true, get: function () { return take_1.opTake; } });
|
|
32
|
+
Object.defineProperty(exports, "opTakeAsync", { enumerable: true, get: function () { return take_1.opTakeAsync; } });
|
|
33
|
+
Object.defineProperty(exports, "opTakeSync", { enumerable: true, get: function () { return take_1.opTakeSync; } });
|
|
34
|
+
var tap_1 = require("./tap");
|
|
35
|
+
Object.defineProperty(exports, "opTap", { enumerable: true, get: function () { return tap_1.opTap; } });
|
|
36
|
+
Object.defineProperty(exports, "opTapAsync", { enumerable: true, get: function () { return tap_1.opTapAsync; } });
|
|
37
|
+
Object.defineProperty(exports, "opTapSync", { enumerable: true, get: function () { return tap_1.opTapSync; } });
|
|
22
38
|
var unique_1 = require("./unique");
|
|
23
39
|
Object.defineProperty(exports, "opUnique", { enumerable: true, get: function () { return unique_1.opUnique; } });
|
|
24
40
|
Object.defineProperty(exports, "opUniqueAsync", { enumerable: true, get: function () { return unique_1.opUniqueAsync; } });
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function opSkipAsync<T>(count: number): (iter: AsyncIterable<T> | Iterable<T>) => AsyncIterable<T>;
|
|
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>;
|
|
4
|
+
//# sourceMappingURL=skip.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.opSkip = exports.opSkipSync = exports.opSkipAsync = void 0;
|
|
4
|
+
const util_1 = require("../helpers/util");
|
|
5
|
+
function opSkipAsync(count) {
|
|
6
|
+
async function* fn(iter) {
|
|
7
|
+
for await (const v of iter) {
|
|
8
|
+
if (count > 0) {
|
|
9
|
+
--count;
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
yield v;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return fn;
|
|
16
|
+
}
|
|
17
|
+
exports.opSkipAsync = opSkipAsync;
|
|
18
|
+
function opSkipSync(count) {
|
|
19
|
+
function* fn(iter) {
|
|
20
|
+
for (const v of iter) {
|
|
21
|
+
if (count > 0) {
|
|
22
|
+
--count;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
yield v;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return fn;
|
|
29
|
+
}
|
|
30
|
+
exports.opSkipSync = opSkipSync;
|
|
31
|
+
const opSkip = (count) => (0, util_1.toPipeFn)(opSkipSync(count), opSkipAsync(count));
|
|
32
|
+
exports.opSkip = opSkip;
|
|
33
|
+
//# sourceMappingURL=skip.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function opTakeAsync<T>(count: number): (iter: AsyncIterable<T> | Iterable<T>) => AsyncIterable<T>;
|
|
2
|
+
export declare function opTakeSync<T>(count: number): (iter: Iterable<T>) => Iterable<T>;
|
|
3
|
+
export declare const opTake: <T>(count: number) => import("../internalTypes").PipeFn<T, T>;
|
|
4
|
+
//# sourceMappingURL=take.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.opTake = exports.opTakeSync = exports.opTakeAsync = void 0;
|
|
4
|
+
const util_1 = require("../helpers/util");
|
|
5
|
+
function opTakeAsync(count) {
|
|
6
|
+
async function* fn(iter) {
|
|
7
|
+
if (count <= 0)
|
|
8
|
+
return;
|
|
9
|
+
for await (const v of iter) {
|
|
10
|
+
yield v;
|
|
11
|
+
if (--count <= 0)
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return fn;
|
|
16
|
+
}
|
|
17
|
+
exports.opTakeAsync = opTakeAsync;
|
|
18
|
+
function opTakeSync(count) {
|
|
19
|
+
function* fn(iter) {
|
|
20
|
+
if (count <= 0)
|
|
21
|
+
return;
|
|
22
|
+
for (const v of iter) {
|
|
23
|
+
yield v;
|
|
24
|
+
if (--count <= 0)
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return fn;
|
|
29
|
+
}
|
|
30
|
+
exports.opTakeSync = opTakeSync;
|
|
31
|
+
const opTake = (count) => (0, util_1.toPipeFn)(opTakeSync(count), opTakeAsync(count));
|
|
32
|
+
exports.opTake = opTake;
|
|
33
|
+
//# sourceMappingURL=take.js.map
|
|
@@ -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").PipeFn<T, T>;
|
|
19
|
+
//# sourceMappingURL=tap.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.opTap = exports.opTapSync = exports.opTapAsync = void 0;
|
|
4
|
+
const util_1 = require("../helpers/util");
|
|
5
|
+
/**
|
|
6
|
+
* Tap allows you to listen on values, without modifying them.
|
|
7
|
+
*
|
|
8
|
+
* @param fn - function to call for each value.
|
|
9
|
+
*/
|
|
10
|
+
function opTapAsync(tapFn) {
|
|
11
|
+
async function* fn(iter) {
|
|
12
|
+
for await (const v of iter) {
|
|
13
|
+
tapFn(v);
|
|
14
|
+
yield v;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return fn;
|
|
18
|
+
}
|
|
19
|
+
exports.opTapAsync = opTapAsync;
|
|
20
|
+
/**
|
|
21
|
+
* Tap allows you to listen on values, without modifying them.
|
|
22
|
+
*
|
|
23
|
+
* @param fn - function to call for each value.
|
|
24
|
+
*/
|
|
25
|
+
function opTapSync(tapFn) {
|
|
26
|
+
function* fn(iter) {
|
|
27
|
+
for (const v of iter) {
|
|
28
|
+
tapFn(v);
|
|
29
|
+
yield v;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return fn;
|
|
33
|
+
}
|
|
34
|
+
exports.opTapSync = opTapSync;
|
|
35
|
+
/**
|
|
36
|
+
* Tap allows you to listen on values, without modifying them.
|
|
37
|
+
*
|
|
38
|
+
* @param fn - function to call for each value.
|
|
39
|
+
*/
|
|
40
|
+
const opTap = (fn) => (0, util_1.toPipeFn)(opTapSync(fn), opTapAsync(fn));
|
|
41
|
+
exports.opTap = opTap;
|
|
42
|
+
//# sourceMappingURL=tap.js.map
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "5.
|
|
6
|
+
"version": "5.19.0",
|
|
7
7
|
"description": "Library to make working with Iterators/AsyncIterators easier.",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"cspell",
|
|
@@ -67,8 +67,9 @@
|
|
|
67
67
|
"files": [
|
|
68
68
|
"dist",
|
|
69
69
|
"!**/__mocks__",
|
|
70
|
-
"!**/*.test.*",
|
|
71
70
|
"!**/*.spec.*",
|
|
71
|
+
"!**/*.test.*",
|
|
72
|
+
"!**/test/**",
|
|
72
73
|
"!**/*.map"
|
|
73
74
|
],
|
|
74
75
|
"scripts": {
|
|
@@ -92,9 +93,9 @@
|
|
|
92
93
|
"node": ">=12.13.0"
|
|
93
94
|
},
|
|
94
95
|
"devDependencies": {
|
|
95
|
-
"@types/node": "^17.0.
|
|
96
|
-
"jest": "^27.
|
|
96
|
+
"@types/node": "^17.0.21",
|
|
97
|
+
"jest": "^27.5.1",
|
|
97
98
|
"rimraf": "^3.0.2"
|
|
98
99
|
},
|
|
99
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "7873efe40a3287d3e025f705e1712c12d3cb392e"
|
|
100
101
|
}
|