-
Notifications
You must be signed in to change notification settings - Fork 0
/
reflection.js
39 lines (34 loc) · 988 Bytes
/
reflection.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
;(function(){
"use strict";
var Reflection = function(obj) {
var obj = obj || {};
this.getProperties = function() {
var properties = [];
for (var p in obj) {
if ( typeof obj[p] != 'function' ) {
properties.push(p);
}
}
return properties;
};
this.getMethods = function() {
var methods = [];
for (var m in obj) {
if ( typeof obj[m] == 'function' ) {
methods.push(m);
}
}
return methods;
};
this.getOwnMethods = function() {
var methods = [];
for (var m in obj) {
if ( typeof obj[m] == 'function' && obj.hasOwnProperty(m) ) {
methods.push(m);
}
}
return methods;
};
};
window.Reflection = Reflection;
})();