the-forest/client/node_modules/.cache/babel-loader/da15b89769b67f3851bf4dbc3d993023fbc9d745d9c97bd4b883b01c8f159434.json

1 line
7.0 KiB
JSON
Raw Normal View History

2024-09-17 20:35:18 -04:00
{"ast":null,"code":"\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.writeJsonObject = exports.ObjectWriter = void 0;\nclass 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}\nexports.ObjectWriter = ObjectWriter;\nfunction 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}\nexports.writeJsonObject = writeJsonObject;","map":{"version":3,"names":["Object","defineProperty","exports","value","writeJsonObject","ObjectWriter","output","isFirst","constructor","begin","push","end","key","#key","name","string","JSON","stringify","stringRaw","number","boolean","object","valueFun","arrayObjects","values","i","length","fun","writer","join"],"sources":["/Users/shoofle/Projects/the-forest/node_modules/@libsql/hrana-client/lib-cjs/encoding/json/encode.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.writeJsonObject = exports.ObjectWriter = void 0;\nclass 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}\nexports.ObjectWriter = ObjectWriter;\nf