Skip to content

Commit 2804f61

Browse files
committed
refactor: replace JSON.stringify with lossless-json.stringify in utils.ts
1 parent e9220a7 commit 2804f61

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/utils.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,7 @@ export function generateFlowSourceCode(
177177
return `/* @pos ${nodeId} ${index} */ ${refCode}`;
178178
}
179179
if (val.__typename === "LiteralValue") {
180-
const jsonString = JSON.stringify(val?.value, (key, val) =>
181-
typeof val === 'bigint' ? val.toString() : val
182-
)
180+
const jsonString = stringify(val?.value)
183181
return `/* @pos ${nodeId} ${index} */ ${jsonString}`;
184182
}
185183
if (val.__typename === "NodeFunctionIdWrapper") {
@@ -227,7 +225,7 @@ export function generateFlowSourceCode(
227225
if (p?.value?.__typename === "NodeFunctionIdWrapper" && p.value.id) subTreeIds.add(p.value.id);
228226
}));
229227

230-
const flowCode = flow ? `const flow_${sanitizeId(flow.id ?? "")} = flow(${flow.settings?.nodes?.map((setting, index) => `/* @pos undefined ${index} */ ${JSON.stringify(setting?.value)}`).join(", ") ?? ""});` : ""
228+
const flowCode = flow ? `const flow_${sanitizeId(flow.id ?? "")} = flow(${flow.settings?.nodes?.map((setting, index) => `/* @pos undefined ${index} */ ${stringify(setting?.value)}`).join(", ") ?? ""});` : ""
231229

232230
const executionCode = nodes
233231
.filter(n => n?.id && !nextNodeIds.has(n.id) && !subTreeIds.has(n.id))

0 commit comments

Comments
 (0)