From ebb85f3feb510f7ac8ccbde156940461b878633e Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 22 Jan 2013 09:41:49 -0500 Subject: [PATCH] minor changes --- lib/util.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/lib/util.js b/lib/util.js index 03db79c9..4ee0ed25 100644 --- a/lib/util.js +++ b/lib/util.js @@ -491,6 +491,18 @@ Util = exports || {}; return lRet; }; + /** + * exec function if it exist in object + * @pArg + */ + Util.execIfExist = function(pObj, pName, pArg){ + var lRet; + if(pObj) + lRet = Util.exec(pObj[pName], pArg); + + return lRet; + }; + /** * function do conditional save exec of function * @param pCondition @@ -525,6 +537,32 @@ Util = exports || {}; return lRet; }; + + + /** + * start timer + * @pArg + */ + Util.time = function(pArg){ + var lRet, + lConsole = Scope.console; + + lRet = Util.execIfExist(lConsole, 'time', pArg); + + return lRet; + }; + /** + * stop timer + * @pArg + */ + Util.timeEnd = function(pArg){ + var lRet, + lConsole = Scope.console; + + lRet = Util.execIfExist(lConsole, 'timeEnd', pArg); + + return this; + }; /** * Gets current date in format yy.mm.dd hh:mm:ss */