safeSerialize() — dead-code-hunter Function Reference
Architecture documentation for the safeSerialize() function in index.ts from the dead-code-hunter codebase.
Entity Profile
Dependency Diagram
graph TD 78e42b23_047d_0841_e86a_607eff1a77ba["safeSerialize()"] 1916269f_4df6_c8ce_0c1a_a8a66a4fb245["index.ts"] 78e42b23_047d_0841_e86a_607eff1a77ba -->|defined in| 1916269f_4df6_c8ce_0c1a_a8a66a4fb245 0c3136ed_f7b1_d5d1_589e_7b15515e6598["run()"] 0c3136ed_f7b1_d5d1_589e_7b15515e6598 -->|calls| 78e42b23_047d_0841_e86a_607eff1a77ba style 78e42b23_047d_0841_e86a_607eff1a77ba fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/index.ts lines 35–63
function safeSerialize(value: unknown, maxLength = MAX_VALUE_LENGTH): string {
try {
const seen = new WeakSet();
const serialized = JSON.stringify(value, (key, val) => {
if (key && SENSITIVE_KEYS.has(key.toLowerCase())) {
return '[REDACTED]';
}
if (typeof val === 'bigint') {
return val.toString();
}
if (typeof val === 'object' && val !== null) {
if (seen.has(val)) {
return '[Circular]';
}
seen.add(val);
}
return val;
}, 2);
if (serialized && serialized.length > maxLength) {
return serialized.slice(0, maxLength) + '... [truncated]';
}
return serialized ?? '[undefined]';
} catch {
return '[unserializable]';
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does safeSerialize() do?
safeSerialize() is a function in the dead-code-hunter codebase, defined in src/index.ts.
Where is safeSerialize() defined?
safeSerialize() is defined in src/index.ts at line 35.
What calls safeSerialize()?
safeSerialize() is called by 1 function(s): run.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free