UNPKG

1 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.JSONStringifyStream = void 0;
4// deno-lint-ignore-file no-explicit-any
5const json_stringify_js_1 = require("./json-stringify.js");
6class 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}
29exports.JSONStringifyStream = JSONStringifyStream;
30//# sourceMappingURL=json-stringify-stream.js.map
\No newline at end of file