From c8cc037ef67954558a461cb759f247b2a8d16294 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 25 May 2012 19:28:39 +0200 Subject: [PATCH] in Ox.wrap, iterate over Ox.methods(Ox) --- source/Ox/js/Core.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/source/Ox/js/Core.js b/source/Ox/js/Core.js index f8612de8..de9678a4 100644 --- a/source/Ox/js/Core.js +++ b/source/Ox/js/Core.js @@ -344,16 +344,12 @@ Ox.wrap = function(value, chained) { return value; } }; - Object.getOwnPropertyNames(Ox).forEach(function(name) { - if ( - ['arguments', 'callee', 'caller', 'length'].indexOf(name) == -1 - && name[0] == name[0].toLowerCase() - && Ox.isFunction(Ox[name]) - ) { - wrapper[name] = function() { + Ox.methods(Ox).forEach(function(method) { + if (method[0] == method[0].toLowerCase()) { + wrapper[method] = function() { var args = Array.prototype.slice.call(arguments), ret; args.unshift(value); - ret = Ox[name].apply(Ox, args); + ret = Ox[method].apply(Ox, args); return wrapper.chained ? Ox.wrap(ret, true) : ret; }; }