mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(util) rmNewLine: substr -> removeStr
This commit is contained in:
parent
8d2e0548e9
commit
6ada9d6ace
1 changed files with 3 additions and 6 deletions
|
|
@ -65,13 +65,10 @@ Util = exports || {};
|
|||
* @param {string} pText
|
||||
*/
|
||||
Util.rmNewLine = function(pText){
|
||||
var n = pText && pText.length - 1,
|
||||
char = pText[n];
|
||||
var strs = ['\n', '\r'],
|
||||
text = Util.removeStr(pText, strs);
|
||||
|
||||
if (n && char === '\n' || char === '\r')
|
||||
pText = pText.substr(pText, n);
|
||||
|
||||
return pText;
|
||||
return text;
|
||||
};
|
||||
|
||||
/** setting function context
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue