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;
|
return value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Object.getOwnPropertyNames(Ox).forEach(function(name) {
|
Ox.methods(Ox).forEach(function(method) {
|
||||||
if (
|
if (method[0] == method[0].toLowerCase()) {
|
||||||
['arguments', 'callee', 'caller', 'length'].indexOf(name) == -1
|
wrapper[method] = function() {
|
||||||
&& name[0] == name[0].toLowerCase()
|
|
||||||
&& Ox.isFunction(Ox[name])
|
|
||||||
) {
|
|
||||||
wrapper[name] = function() {
|
|
||||||
var args = Array.prototype.slice.call(arguments), ret;
|
var args = Array.prototype.slice.call(arguments), ret;
|
||||||
args.unshift(value);
|
args.unshift(value);
|
||||||
ret = Ox[name].apply(Ox, args);
|
ret = Ox[method].apply(Ox, args);
|
||||||
return wrapper.chained ? Ox.wrap(ret, true) : ret;
|
return wrapper.chained ? Ox.wrap(ret, true) : ret;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue