refactor(util) addNewLine, rmNewLine

This commit is contained in:
coderaiser 2014-03-11 10:51:34 -04:00
parent ea50210887
commit 6653feb6f4

View file

@ -74,25 +74,25 @@
* ad new line (if it's not)
* @param {string} pText
*/
this.addNewLine = function(pText) {
var lNewLine = '',
n = pText && pText.length;
this.addNewLine = function(text) {
var newLine = '',
n = text && text.length;
if(n && pText[n-1] !== '\n')
lNewLine = '\n';
if(n && text[n-1] !== '\n')
newLine = '\n';
return pText + lNewLine;
return text + newLine;
};
/**
* rm new line (if it's)
* @param {string} pText
*/
this.rmNewLine = function(pText) {
var strs = ['\n', '\r'],
text = Util.removeStr(pText, strs);
this.rmNewLine = function(text) {
var strs = ['\n', '\r'],
str = Util.removeStr(text, strs);
return text;
return str;
};
/**