mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +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
15 lines
591 B
TypeScript
15 lines
591 B
TypeScript
export {};
|
|
|
|
const trace: string[] = [];
|
|
function observe(key: string, value: unknown): unknown {
|
|
trace.push(key + ":" + typeof value);
|
|
return value;
|
|
}
|
|
console.log(JSON.stringify({ bytes: new Uint8Array([3, 4]) }, observe));
|
|
console.log(trace.join("|"));
|
|
console.log(JSON.stringify({ replace: 0 }, (key: string, value: unknown): unknown => {
|
|
return key === "replace" ? new Uint8Array([5, 6]) : value;
|
|
}));
|
|
console.log(JSON.stringify(0, (key: string, value: unknown): unknown => key === "" ? new Uint8Array([7, 8]) : value));
|
|
console.log(JSON.stringify(new Uint8Array([]), observe, 2));
|