1 line
6.3 KiB
JSON
1 line
6.3 KiB
JSON
|
{"ast":null,"code":"export class ObjectWriter {\n #output;\n #isFirst;\n constructor(output) {\n this.#output = output;\n this.#isFirst = false;\n }\n begin() {\n this.#output.push('{');\n this.#isFirst = true;\n }\n end() {\n this.#output.push('}');\n this.#isFirst = false;\n }\n #key(name) {\n if (this.#isFirst) {\n this.#output.push('\"');\n this.#isFirst = false;\n } else {\n this.#output.push(',\"');\n }\n this.#output.push(name);\n this.#output.push('\":');\n }\n string(name, value) {\n this.#key(name);\n this.#output.push(JSON.stringify(value));\n }\n stringRaw(name, value) {\n this.#key(name);\n this.#output.push('\"');\n this.#output.push(value);\n this.#output.push('\"');\n }\n number(name, value) {\n this.#key(name);\n this.#output.push(\"\" + value);\n }\n boolean(name, value) {\n this.#key(name);\n this.#output.push(value ? \"true\" : \"false\");\n }\n object(name, value, valueFun) {\n this.#key(name);\n this.begin();\n valueFun(this, value);\n this.end();\n }\n arrayObjects(name, values, valueFun) {\n this.#key(name);\n this.#output.push('[');\n for (let i = 0; i < values.length; ++i) {\n if (i !== 0) {\n this.#output.push(',');\n }\n this.begin();\n valueFun(this, values[i]);\n this.end();\n }\n this.#output.push(']');\n }\n}\nexport function writeJsonObject(value, fun) {\n const output = [];\n const writer = new ObjectWriter(output);\n writer.begin();\n fun(writer, value);\n writer.end();\n return output.join(\"\");\n}","map":{"version":3,"names":["ObjectWriter","output","isFirst","constructor","begin","push","end","key","#key","name","string","value","JSON","stringify","stringRaw","number","boolean","object","valueFun","arrayObjects","values","i","length","writeJsonObject","fun","writer","join"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-esm/encoding/json/encode.js"],"sourcesContent":["export class ObjectWriter {\n #output;\n #isFirst;\n constructor(output) {\n this.#output = output;\n this.#isFirst = false;\n }\n begin() {\n this.#output.push('{');\n this.#isFirst = true;\n }\n end() {\n this.#output.push('}');\n this.#isFirst = false;\n }\n #key(name) {\n if (this.#isFirst) {\n this.#output.push('\"');\n this.#isFirst = false;\n }\n else {\n this.#output.push(',\"');\n }\n this.#output.push(name);\n this.#output.push('\":');\n }\n string(name, value) {\n this.#key(name);\n this.#output.push(JSON.stringify(value));\n }\n stringRaw(name, value) {\n this.#key(name);\n this.#output.push('\"');\n this.#output.push(value);\n this.#output.push('\"');\n }\n number(name, value) {\n this.#key(name);\n this.#output.push(\"\" + value);\n }\n boolean(name, value) {\n this.#key(name);\n this.#output.push(value ? \"true\" : \"false\");\n }\n object(name, value, valueFun) {\n this.#key(name);\n this.begin();\n valueFun(this, value);\n this.end();\n }\n arrayObjects(name, values, valueFun) {\n this.#key(name);\n this.#output.push('[');\n for (let i = 0; i < values.length; ++i) {\n if (i !== 0) {\n this.#output.push(',');\n }\n this.begin();\n valueFun(this, values[i]);\n this.end();\n }\n this.#output.push(']');\n }\n}\nexport function writeJsonObject(value, fun) {\n const output = [];\n const writer = new ObjectWriter(output);\n writer.begin();\n fun(writer, value);\n writer.end();\n return output.join(\"\");\n}\n"],"mappings":"AAAA,OAAO,MAAMA,YAAY,CAAC;EACtB,CAACC,MAAM;EACP,CAACC,OAAO;EACRC,WAAWA,CAACF,MAAM,EAAE;IAChB,IAAI,CAAC,CAACA,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACC,OAAO,GAAG,KAAK;EACzB;EACAE,KAAKA,CAAA,EAAG;IAC
|