Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3055643
json_stringify_nested_function_replacer.cjs
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
339 B
Referenced Files
None
Subscribers
None
json_stringify_nested_function_replacer.cjs
View Options
const obj = {
action() {
return 1;
},
child: {
inner() {
return 2;
},
},
missing: undefined,
};
const out = JSON.stringify(obj, (_key, value) => {
if (typeof value === 'function') return `[fn:${value.name || 'anonymous'}]`;
if (value === undefined) return '[undef]';
return value;
});
console.log(out);
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Apr 3, 5:10 PM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
521545
Default Alt Text
json_stringify_nested_function_replacer.cjs (339 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment