The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
export function prettyPrint(value: any, indent = 2) {
return JSON.stringify(
value,
(_key, val) => {
if (val instanceof Set) return { __type: "Set", values: [...val] };
if (val instanceof Map)
return { __type: "Map", entries: [...val.entries()] };
if (val instanceof Date) return val.toISOString();
if (val instanceof Error)
return { __type: "Error", message: val.message, stack: val.stack };
return val;
},
indent,
);
}