MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / stableStringify

Function stableStringify

scripts/bench-full-compare.mjs:140–149  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

138}
139
140function stableStringify(value) {
141 if (Array.isArray(value)) {
142 return `[${value.map((entry) => stableStringify(entry)).join(",")}]`;
143 }
144 if (isPlainObject(value)) {
145 const keys = Object.keys(value).sort();
146 return `{${keys.map((k) => `${JSON.stringify(k)}:${stableStringify(value[k])}`).join(",")}}`;
147 }
148 return JSON.stringify(value);
149}
150
151function makeKey(entry) {
152 const scenario = typeof entry.scenario === "string" ? entry.scenario : "";

Callers 1

makeKeyFunction · 0.70

Calls 2

isPlainObjectFunction · 0.70
keysMethod · 0.65

Tested by

no test coverage detected