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

Function GetProperties

deps/v8/tools/detect-builtins.js:7–57  ·  view source on GitHub ↗
(this_name, object)

Source from the content-addressed store, hash-verified

5(function(global) {
6
7 var GetProperties = function(this_name, object) {
8 var result = {};
9 try {
10 var names = Object.getOwnPropertyNames(object);
11 } catch(e) {
12 return;
13 }
14 for (var i = 0; i < names.length; ++i) {
15 var name = names[i];
16 if (typeof object === "function") {
17 if (name === "length" ||
18 name === "name" ||
19 name === "arguments" ||
20 name === "caller" ||
21 name === "prototype") {
22 continue;
23 }
24 }
25 // Avoid endless recursion.
26 if (this_name === "prototype" && name === "constructor") continue;
27 // Avoid needless duplication.
28 if (this_name === "__PROTO__" && name === "constructor") continue;
29 // Could get this from the parent, but having it locally is easier.
30 var property = { "name": name };
31 try {
32 var value = object[name];
33 } catch(e) {
34 property.type = "getter";
35 result[name] = property;
36 continue;
37 }
38 var type = typeof value;
39 property.type = type;
40 if (type === "function") {
41 property.length = value.length;
42 property.prototype = GetProperties("prototype", value.prototype);
43 }
44 if (type === "string" || type === "number") {
45 property.value = value;
46 } else {
47 property.properties = GetProperties(name, value);
48 }
49 result[name] = property;
50 }
51 // Print the __proto__ if it's not the default Object prototype.
52 if (typeof object === "object" && object.__proto__ !== null &&
53 !object.__proto__.hasOwnProperty("__proto__")) {
54 result.__PROTO__ = GetProperties("__PROTO__", object.__proto__);
55 }
56 return result;
57 };
58
59 var g = GetProperties("", global, "");
60 print(JSON.stringify(g, undefined, 2));

Callers 1

detect-builtins.jsFile · 0.85

Calls 1

hasOwnPropertyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…