feature(util) add addNewLine

This commit is contained in:
coderaiser 2013-10-24 10:51:43 +00:00
parent 1ff073d78b
commit e25d526ac4
2 changed files with 17 additions and 1 deletions

View file

@ -215,7 +215,9 @@
if (!Util.isString(lError))
lErrorStr = lError.toString() + '\n';
lErrorStr = lError.toString();
lErrorStr = Util.addNewLine(lErrorStr);
lExec = {
stdout : pStdout,

View file

@ -46,6 +46,20 @@ Util = exports || {};
}
},
/**
* ad new line (if it's not)
* @param {string} pText
*/
Util.addNewLine = function(pText){
var lNewLine = '',
n = pText && pText.length;
if(n && pText[n-1] !== '\n')
lNewLine = '\n';
return pText + lNewLine;
};
/** setting function context
* @param {function} pFunction
* @param {object} pContext