UNPKG

@fiberplane/hono-otel

Version:

Hono middleware to forward OpenTelemetry traces to a local instance of @fiberplane/studio

18 lines (17 loc) 547 B
import { isUintArray } from "./uint.js"; export function safelySerializeJSON(obj) { const seen = new WeakSet(); return JSON.stringify(obj, (_key, value) => { // HACK - Do not serialize binary data - There is probably a smarter way to do this if (isUintArray(value)) { return "BINARY"; } if (typeof value === "object" && value !== null) { if (seen.has(value)) { return "[Circular]"; } seen.add(value); } return value; }); }