1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.JSONStringifyStream = void 0;
|
4 |
|
5 | const json_stringify_js_1 = require("./json-stringify.js");
|
6 | class JSONStringifyStream extends TransformStream {
|
7 | constructor() {
|
8 | let first;
|
9 | super({
|
10 | start(controller) {
|
11 | first = true;
|
12 | controller.enqueue('[');
|
13 | },
|
14 | async transform(obj, controller) {
|
15 | if (!first)
|
16 | controller.enqueue(',');
|
17 | else
|
18 | first = false;
|
19 | for await (const chunk of (0, json_stringify_js_1.jsonStringifyGenerator)(obj)) {
|
20 | controller.enqueue(chunk);
|
21 | }
|
22 | },
|
23 | flush(controller) {
|
24 | controller.enqueue(']');
|
25 | },
|
26 | });
|
27 | }
|
28 | }
|
29 | exports.JSONStringifyStream = JSONStringifyStream;
|
30 |
|
\ | No newline at end of file |