diff --git a/source/Ox/js/Object.js b/source/Ox/js/Object.js index efcb042c..439b94b7 100644 --- a/source/Ox/js/Object.js +++ b/source/Ox/js/Object.js @@ -6,7 +6,7 @@ Ox.extend Extends an object with one or more other objects {a: 1, b: 2, c: 3} @*/ Ox.extend = function(obj) { - Ox.forEach(Array.prototype.slice.call(arguments, 1), function(arg, i) { + Ox.forEach(Ox.slice(arguments, 1), function(arg, i) { Ox.forEach(arg, function(val, key) { obj[key] = val; }); @@ -39,8 +39,17 @@ Ox.methods Returns a sorted list of all method names of an object > Ox.methods({a: [], b: false, f: function() {}, n: 0, o: {}, s: ''}) ['f'] @*/ -Ox.methods = function(obj) { - return Object.keys(obj).filter(function(key) { +Ox.methods = function(obj, includePrototype) { + var key, keys; + if (includePrototype) { + keys = []; + for (var key in obj) { + keys.push(key); + } + } else { + keys = Object.keys(obj); + } + return keys.filter(function(key) { return Ox.isFunction(obj[key]); }).sort(); };