mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
- Compile production IR serialization and runtime dependency scans on both native backends - Support native JSON callbacks and checked records with unknown payloads - Verify native IR round trips and executable generation with focused sanitizer coverage
18 lines
865 B
TypeScript
18 lines
865 B
TypeScript
export {};
|
|
|
|
const value = { a: [1, { b: true }], empty: {}, list: [], drop: 7 };
|
|
function identity(key: string, value: unknown): unknown {
|
|
return key === "drop" ? undefined : value;
|
|
}
|
|
console.log(JSON.stringify(value, identity));
|
|
console.log(JSON.stringify(value, identity, 0));
|
|
console.log(JSON.stringify(value, identity, -3));
|
|
console.log(JSON.stringify(value, identity, 2.8));
|
|
console.log(JSON.stringify(value, identity, 20));
|
|
console.log(JSON.stringify(value, identity, "abcdefghijk"));
|
|
console.log(JSON.stringify(value, identity, "\t"));
|
|
console.log(JSON.stringify(value, identity, undefined));
|
|
console.log(JSON.stringify({ a: 1 }, () => undefined, 2) === undefined);
|
|
console.log(JSON.stringify({ a: 1 }, () => "escaped\n\t\"\\", 2));
|
|
console.log(JSON.stringify({ omit: 1 }, (key: string, value: unknown): unknown => key === "omit" ? undefined : value, 2));
|