mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 17:05:17 +00:00
feature(util) add rmNewLine
This commit is contained in:
parent
042e0ba70c
commit
c5e11681f1
1 changed files with 13 additions and 0 deletions
13
lib/util.js
13
lib/util.js
|
|
@ -60,6 +60,19 @@ Util = exports || {};
|
|||
return pText + lNewLine;
|
||||
};
|
||||
|
||||
/**
|
||||
* rm new line (if it's)
|
||||
* @param {string} pText
|
||||
*/
|
||||
Util.rmNewLine = function(pText){
|
||||
var n = pText && pText.length - 1;
|
||||
|
||||
if (n && pText[n] == '\n')
|
||||
pText = pText.substr(pText, n);
|
||||
|
||||
return pText;
|
||||
};
|
||||
|
||||
/** setting function context
|
||||
* @param {function} pFunction
|
||||
* @param {object} pContext
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue