in Ox.wrap, iterate over Ox.methods(Ox)
This commit is contained in:
parent
c56b7cc9ed
commit
c8cc037ef6
1 changed files with 4 additions and 8 deletions
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue