MCPcopy Index your code
hub / github.com/nodejs/node / TryGetAllProperties

Function TryGetAllProperties

lib/internal/error_serdes.js:48–80  ·  view source on GitHub ↗
(object, target = object, rememberSet)

Source from the content-addressed store, hash-verified

46const errorConstructorNames = new SafeSet(ObjectKeys(errors));
47
48function TryGetAllProperties(object, target = object, rememberSet) {
49 const all = { __proto__: null };
50 if (object === null)
51 return all;
52 ObjectAssign(all,
53 TryGetAllProperties(ObjectGetPrototypeOf(object), target, rememberSet));
54 const keys = ObjectGetOwnPropertyNames(object);
55 ArrayPrototypeForEach(keys, (key) => {
56 let descriptor;
57 try {
58 // TODO: create a null-prototype descriptor with needed properties only
59 descriptor = ObjectGetOwnPropertyDescriptor(object, key);
60 } catch { return; }
61 const getter = descriptor.get;
62 if (getter && key !== '__proto__') {
63 try {
64 descriptor.value = FunctionPrototypeCall(getter, target);
65 delete descriptor.get;
66 delete descriptor.set;
67 } catch {
68 // Continue regardless of error.
69 }
70 }
71 if (key === 'cause') {
72 descriptor.value = serializeError(descriptor.value, rememberSet);
73 all[key] = descriptor;
74 } else if ('value' in descriptor &&
75 typeof descriptor.value !== 'function' && typeof descriptor.value !== 'symbol') {
76 all[key] = descriptor;
77 }
78 });
79 return all;
80}
81
82function GetConstructors(object) {
83 const constructors = [];

Callers 1

serializeErrorFunction · 0.85

Calls 2

ObjectAssignFunction · 0.85
serializeErrorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…