MCPcopy Create free account
hub / github.com/WinterTC55/iter-streams / applyStatefulSyncTransform

Function applyStatefulSyncTransform

src/pull.js:529–556  ·  view source on GitHub ↗

* Apply a single stateful sync transform to a source.

(source, transform)

Source from the content-addressed store, hash-verified

527 * Apply a single stateful sync transform to a source.
528 */
529function applyStatefulSyncTransform(source, transform) {
530 var output, _i, output_1, item, batch, _a, _b, chunk;
531 return __generator(this, function (_c) {
532 switch (_c.label) {
533 case 0:
534 output = transform(source);
535 _i = 0, output_1 = output;
536 _c.label = 1;
537 case 1:
538 if (!(_i < output_1.length)) return [3 /*break*/, 4];
539 item = output_1[_i];
540 batch = [];
541 for (_a = 0, _b = flattenTransformYieldSync(item); _a < _b.length; _a++) {
542 chunk = _b[_a];
543 batch.push(chunk);
544 }
545 if (!(batch.length > 0)) return [3 /*break*/, 3];
546 return [4 /*yield*/, batch];
547 case 2:
548 _c.sent();
549 _c.label = 3;
550 case 3:
551 _i++;
552 return [3 /*break*/, 1];
553 case 4: return [2 /*return*/];
554 }
555 });
556}
557/**
558 * Wrap sync source to add null flush signal at end.
559 */

Callers 1

createSyncPipelineFunction · 0.70

Calls 3

transformFunction · 0.70
pushMethod · 0.65

Tested by

no test coverage detected