Files
scriptc/tests/corpus/json-runtime-options.mjs
Chris Tate 2069684b40 Expand static Effect support across common APIs (#598)
* Expand static Effect support across common APIs

* Preserve compiler parity across expanded Effect patterns

* Fix compiler regressions exposed by Effect coverage

* Bound shared type conversion traversal

* Clarify conversion contracts and tidy fixtures

* Run every Effect fixture in CI shards

* Preserve inferred array assignments in concurrent Effect programs

* Record inferred array fixture compiler ordering
2026-10-01 02:49:31 -05:00

18 lines
680 B
JavaScript

function roundtrip(text, options) {
const value = JSON.parse(text, options?.reviver);
return JSON.stringify(value, options?.replacer, options?.space);
}
console.log(roundtrip('{"n":42}'));
console.log(roundtrip('{"n":42}', { reviver: null, replacer: null, space: 2 }));
console.log(roundtrip('{"n":42}', {
reviver(key, value) { return key === "n" ? value + 1 : value; },
replacer(key, value) { return key === "n" ? value * 2 : value; },
space: "--",
}));
let calls = 0;
try {
roundtrip("{", { reviver() { calls++; } });
} catch (error) { console.log(error.name, calls); }
const gap = process.argv[2];
console.log(JSON.stringify({ n: 1 }, (key, value) => value, gap));