refactur(util) mv {add,rm}NewLine to cloudfunc

This commit is contained in:
coderaiser 2014-03-11 10:59:36 -04:00
parent 6653feb6f4
commit 5f92d4208f
3 changed files with 29 additions and 29 deletions

View file

@ -90,6 +90,31 @@ var Util;
}
};
/**
* ad new line (if it's not)
* @param {string} pText
*/
this.addNewLine = function(text) {
var newLine = '',
n = text && text.length;
if(n && text[n-1] !== '\n')
newLine = '\n';
return text + newLine;
};
/**
* rm new line (if it's)
* @param {string} pText
*/
this.rmNewLine = function(text) {
var strs = ['\n', '\r'],
str = Util.removeStr(text, strs);
return str;
};
this.getJoinURL = function(names) {
var url, isContain,
regExp = new RegExp(',', 'g'),

View file

@ -168,7 +168,7 @@
if (firstChar === '#') {
pCommand = pCommand.slice(1);
pCommand = connName + pCommand;
pCommand = Util.addNewLine(pCommand);
pCommand = CloudFunc.addNewLine(pCommand);
Util.exec(callback, {
stdout: pCommand
@ -197,7 +197,7 @@
else
lErrorStr = lError.toString();
lErrorStr = Util.addNewLine(lErrorStr);
lErrorStr = CloudFunc.addNewLine(lErrorStr);
}
lExec = {
@ -263,7 +263,7 @@
update.get();
Util.exec(callback, {
stdout: Util.addNewLine('update: ok')
stdout: CloudFunc.addNewLine('update: ok')
});
}
@ -296,7 +296,7 @@
Util.exec(callback, {
stderr : lMsg,
stdout : Util.rmNewLine(stdout)
stdout : CloudFunc.rmNewLine(stdout)
});
});
}

View file

@ -70,31 +70,6 @@
return result;
};
/**
* ad new line (if it's not)
* @param {string} pText
*/
this.addNewLine = function(text) {
var newLine = '',
n = text && text.length;
if(n && text[n-1] !== '\n')
newLine = '\n';
return text + newLine;
};
/**
* rm new line (if it's)
* @param {string} pText
*/
this.rmNewLine = function(text) {
var strs = ['\n', '\r'],
str = Util.removeStr(text, strs);
return str;
};
/**
* Функция ищет в имени файла расширение
* и если находит возвращает true