mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(util) add addNewLine
This commit is contained in:
parent
1ff073d78b
commit
e25d526ac4
2 changed files with 17 additions and 1 deletions
|
|
@ -215,7 +215,9 @@
|
|||
|
||||
|
||||
if (!Util.isString(lError))
|
||||
lErrorStr = lError.toString() + '\n';
|
||||
lErrorStr = lError.toString();
|
||||
|
||||
lErrorStr = Util.addNewLine(lErrorStr);
|
||||
|
||||
lExec = {
|
||||
stdout : pStdout,
|
||||
|
|
|
|||
14
lib/util.js
14
lib/util.js
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue