@naturalcycles/nodejs-lib 15.68.0 → 15.69.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/stream/pipeline.d.ts +1 -0
- package/dist/stream/pipeline.js +11 -0
- package/package.json +1 -1
- package/src/stream/pipeline.ts +17 -0
|
@@ -109,6 +109,7 @@ export declare class Pipeline<T = unknown> {
|
|
|
109
109
|
toNDJsonFile(outputFilePath: string): Promise<void>;
|
|
110
110
|
to(destination: WritableTyped<T>): Promise<void>;
|
|
111
111
|
forEach(fn: AsyncIndexedMapper<T, void>, opt?: TransformMapOptions<T, void> & TransformLogProgressOptions<T>): Promise<void>;
|
|
112
|
+
forEach2(fn: AsyncIndexedMapper<T, void>, opt?: TransformMap2Options<T, void> & TransformLogProgressOptions<T>): Promise<void>;
|
|
112
113
|
forEachSync(fn: IndexedMapper<T, void>, opt?: TransformMapSyncOptions<T, void> & TransformLogProgressOptions<T>): Promise<void>;
|
|
113
114
|
run(): Promise<void>;
|
|
114
115
|
}
|
package/dist/stream/pipeline.js
CHANGED
|
@@ -324,6 +324,17 @@ export class Pipeline {
|
|
|
324
324
|
}
|
|
325
325
|
await this.run();
|
|
326
326
|
}
|
|
327
|
+
async forEach2(fn, opt = {}) {
|
|
328
|
+
this.transforms.push(transformMap2(fn, {
|
|
329
|
+
predicate: opt.logEvery ? _passthroughPredicate : undefined, // for the logger to work
|
|
330
|
+
...opt,
|
|
331
|
+
signal: this.abortableSignal,
|
|
332
|
+
}));
|
|
333
|
+
if (opt.logEvery) {
|
|
334
|
+
this.transforms.push(transformLogProgress(opt));
|
|
335
|
+
}
|
|
336
|
+
await this.run();
|
|
337
|
+
}
|
|
327
338
|
async forEachSync(fn, opt = {}) {
|
|
328
339
|
this.transforms.push(transformMapSync(fn, {
|
|
329
340
|
predicate: opt.logEvery ? _passthroughPredicate : undefined, // for the logger to work
|
package/package.json
CHANGED
package/src/stream/pipeline.ts
CHANGED
|
@@ -445,6 +445,23 @@ export class Pipeline<T = unknown> {
|
|
|
445
445
|
await this.run()
|
|
446
446
|
}
|
|
447
447
|
|
|
448
|
+
async forEach2(
|
|
449
|
+
fn: AsyncIndexedMapper<T, void>,
|
|
450
|
+
opt: TransformMap2Options<T, void> & TransformLogProgressOptions<T> = {},
|
|
451
|
+
): Promise<void> {
|
|
452
|
+
this.transforms.push(
|
|
453
|
+
transformMap2(fn, {
|
|
454
|
+
predicate: opt.logEvery ? _passthroughPredicate : undefined, // for the logger to work
|
|
455
|
+
...opt,
|
|
456
|
+
signal: this.abortableSignal,
|
|
457
|
+
}),
|
|
458
|
+
)
|
|
459
|
+
if (opt.logEvery) {
|
|
460
|
+
this.transforms.push(transformLogProgress(opt))
|
|
461
|
+
}
|
|
462
|
+
await this.run()
|
|
463
|
+
}
|
|
464
|
+
|
|
448
465
|
async forEachSync(
|
|
449
466
|
fn: IndexedMapper<T, void>,
|
|
450
467
|
opt: TransformMapSyncOptions<T, void> & TransformLogProgressOptions<T> = {},
|