MCPcopy Create free account
hub / github.com/facebook/memlab / JSONifyCode

Function JSONifyCode

packages/core/src/lib/Serializer.ts:330–357  ·  view source on GitHub ↗
(
  node: IHeapNode,
  args: JSONifyArgs,
  options: JSONifyOptions,
)

Source from the content-addressed store, hash-verified

328}
329
330function JSONifyCode(
331 node: IHeapNode,
332 args: JSONifyArgs,
333 options: JSONifyOptions,
334): ISerializedInfo {
335 const info = Object.create(null);
336
337 iterateSelectedEdges(node, (edge: IHeapEdge): Optional<{stop: boolean}> => {
338 if (
339 edge.name_or_index === 'name_or_scope_info' &&
340 edge.toNode.name === '(function scope info)'
341 ) {
342 const key = 'variables with non-number values in closure scope chain';
343 info[key] = config.simplifyCodeSerialization
344 ? JSONifyNodeOneLevel(edge.toNode)
345 : JSONifyNode(edge.toNode, args, options);
346 } else if (edge.name_or_index === 'script_or_debug_info') {
347 info['script URL'] = edge.toNode.name;
348 } else {
349 const key = filterJSONPropName(edge.name_or_index);
350 info[key] = config.simplifyCodeSerialization
351 ? JSONifyNodeOneLevel(edge.toNode)
352 : JSONifyNode(edge.toNode, args, options);
353 }
354 return null;
355 });
356 return info;
357}
358
359function JSONifyContext(
360 node: IHeapNode,

Callers 1

JSONifyNodeFunction · 0.85

Calls 4

iterateSelectedEdgesFunction · 0.85
JSONifyNodeOneLevelFunction · 0.85
JSONifyNodeFunction · 0.85
filterJSONPropNameFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…