Open this example in the interactive library
Source code
import { serialize, deserialize, Serializer, Deserializer } from "node:v8";
const roundTrip = (value) => deserialize(serialize(value));
console.log(
(() => {
const obj = {};
obj.self = obj;
const copy = roundTrip(obj);
return copy === copy.self;
})(),
);
Sample output
true
