forked from schindld/jqwet
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpe-inspector.js
54 lines (54 loc) · 1.62 KB
/
pe-inspector.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
(function inspect(parent, depth) {
var console = this.console ? this.console : {
log: function() {}
},
indent = "",
prop,
result;
if (depth === 0) {
console.log("pe");
}
for (var d = 0; d < depth; d++) {
indent += "\u250a ";
}
for (property in parent) {
if (parent.hasOwnProperty(property)) {
prop = parent[property];
switch (typeof prop) {
case 'object':
if (Object.prototype.toString.apply(prop) === '[object Array]') {
console.log(indent + " \u2937." + property + " :: Array");
} else if (typeof prop.nodeName === 'string') {
console.log(indent + " \u2937." + property + " :: DOM object");
} else if (depth < 3) {
console.log(indent + " \u2937." + property + " :: object");
inspect(prop, depth + 1);
}
break;
case 'function':
if (prop.length === 0) {
result = prop();
switch (typeof result) {
case 'undefined':
console.log(indent + " \u2937." + property + " :: function, returns void");
break;
default:
if (typeof result.jquery === 'string') {
console.log(indent + " \u2937." + property + " :: function, returns jQuery object");
} else if (typeof result.nodeName === 'string') {
console.log(indent + " \u2937." + property + " :: function, returns DOM object");
} else {
console.log(indent + " \u2937." + property + " :: function, returns " + typeof result);
}
}
} else {
console.log(indent + " \u2937." + property + " :: function, returns ?");
}
break;
default:
console.log(indent + " \u2937." + property + " :: " + typeof prop);
}
}
}
return true;
}(pe, 0));