feature(util) execIfExist -> exec.ifExist

This commit is contained in:
coderaiser 2014-05-23 02:43:16 -04:00
parent 8060ba2b1b
commit 099d1bfa82

View file

@ -612,7 +612,7 @@
var FILE = '[object File]',
name, is;
name = Util.execIfExist(variable, 'toString');
name = Util.exec.ifExist(variable, 'toString');
is = name === FILE;
@ -806,6 +806,22 @@
return ret;
};
/**
* exec function if it exist in object
* @pArg
*/
exec.ifExist = function(obj, name, arg) {
var ret,
func = obj && obj[name];
if (func) {
func = func.bind(obj);
ret = Util.exec(func, arg);
}
return ret;
};
exec.parallel = function(funcs, callback) {
var i, func,
funcsCount = funcs.length,
@ -845,22 +861,6 @@
return exec;
}
/**
* exec function if it exist in object
* @pArg
*/
this.execIfExist = function(pObj, pName, pArg) {
var ret,
func = pObj && pObj[pName];
if (func) {
func = func.bind(pObj);
ret = Util.exec(func, pArg);
}
return ret;
};
/**
* function do conditional save exec of function
* @param pCondition
@ -968,7 +968,7 @@
this.time = function(name) {
var console = Scope.console;
Util.execIfExist(console, 'time', name);
Util.exec.ifExist(console, 'time', name);
return this;
};
@ -980,7 +980,7 @@
this.timeEnd = function(name) {
var console = Scope.console;
Util.execIfExist(console, 'timeEnd', name);
Util.exec.ifExist(console, 'timeEnd', name);
return this;
};