@cspell/cspell-pipe 5.18.3 → 5.18.4

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 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, opFilter, opFlatten, opJoinStrings, opMap, 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
@@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  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;
22
+ exports.helpers = exports.operators = exports.pipeSync = exports.pipeAsync = exports.opUnique = exports.opTap = exports.opMap = exports.opJoinStrings = exports.opFlatten = exports.opFilter = exports.opAwaitAsync = exports.toAsyncIterable = exports.toArray = exports.isAsyncIterable = void 0;
23
23
  const _helpers = __importStar(require("./helpers"));
24
24
  const _operators = __importStar(require("./operators"));
25
25
  var helpers_1 = require("./helpers");
@@ -32,6 +32,7 @@ Object.defineProperty(exports, "opFilter", { enumerable: true, get: function ()
32
32
  Object.defineProperty(exports, "opFlatten", { enumerable: true, get: function () { return operators_1.opFlatten; } });
33
33
  Object.defineProperty(exports, "opJoinStrings", { enumerable: true, get: function () { return operators_1.opJoinStrings; } });
34
34
  Object.defineProperty(exports, "opMap", { enumerable: true, get: function () { return operators_1.opMap; } });
35
+ Object.defineProperty(exports, "opTap", { enumerable: true, get: function () { return operators_1.opTap; } });
35
36
  Object.defineProperty(exports, "opUnique", { enumerable: true, get: function () { return operators_1.opUnique; } });
36
37
  var pipe_1 = require("./pipe");
37
38
  Object.defineProperty(exports, "pipeAsync", { enumerable: true, get: function () { return pipe_1.pipeAsync; } });
@@ -3,5 +3,6 @@ export { opFilter as opFilter, opFilterAsync, opFilterSync } from './filter';
3
3
  export { opFlatten, opFlattenAsync, opFlattenSync } from './flatten';
4
4
  export { opJoinStrings, opJoinStringsAsync, opJoinStringsSync } from './joinStrings';
5
5
  export { opMap, opMapAsync, opMapSync } from './map';
6
+ export { opTap, opTapAsync, opTapSync } from './tap';
6
7
  export { opUnique, opUniqueAsync, opUniqueSync } from './unique';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
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.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;
4
4
  var await_1 = require("./await");
5
5
  Object.defineProperty(exports, "opAwaitAsync", { enumerable: true, get: function () { return await_1.opAwaitAsync; } });
6
6
  var filter_1 = require("./filter");
@@ -19,6 +19,10 @@ var map_1 = require("./map");
19
19
  Object.defineProperty(exports, "opMap", { enumerable: true, get: function () { return map_1.opMap; } });
20
20
  Object.defineProperty(exports, "opMapAsync", { enumerable: true, get: function () { return map_1.opMapAsync; } });
21
21
  Object.defineProperty(exports, "opMapSync", { enumerable: true, get: function () { return map_1.opMapSync; } });
22
+ var tap_1 = require("./tap");
23
+ Object.defineProperty(exports, "opTap", { enumerable: true, get: function () { return tap_1.opTap; } });
24
+ Object.defineProperty(exports, "opTapAsync", { enumerable: true, get: function () { return tap_1.opTapAsync; } });
25
+ Object.defineProperty(exports, "opTapSync", { enumerable: true, get: function () { return tap_1.opTapSync; } });
22
26
  var unique_1 = require("./unique");
23
27
  Object.defineProperty(exports, "opUnique", { enumerable: true, get: function () { return unique_1.opUnique; } });
24
28
  Object.defineProperty(exports, "opUniqueAsync", { enumerable: true, get: function () { return unique_1.opUniqueAsync; } });
@@ -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.18.3",
6
+ "version": "5.18.4",
7
7
  "description": "Library to make working with Iterators/AsyncIterators easier.",
8
8
  "keywords": [
9
9
  "cspell",
@@ -92,9 +92,9 @@
92
92
  "node": ">=12.13.0"
93
93
  },
94
94
  "devDependencies": {
95
- "@types/node": "^17.0.14",
96
- "jest": "^27.4.7",
95
+ "@types/node": "^17.0.15",
96
+ "jest": "^27.5.0",
97
97
  "rimraf": "^3.0.2"
98
98
  },
99
- "gitHead": "c650c8d0d58fc0398a6f745a0ad48d46f982332f"
99
+ "gitHead": "26769ba64ce9eff227492524e5210709bec36416"
100
100
  }