feature(util) add convertName

This commit is contained in:
coderaiser 2014-04-11 09:58:01 -04:00
parent c969fa59ba
commit 1d7409dd14
2 changed files with 15 additions and 4 deletions

View file

@ -98,10 +98,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
*/
function getItem(name, callback) {
var ret,
icon = name && name.toLowerCase();
icon = Util.removeStr(icon, ['(', ')']);
icon = Util.replaceStr(icon, ' ', '-');
icon = Util.convertName(name);
ret = {
name : name,

View file

@ -510,6 +510,20 @@
return lRet;
};
/**
* function convert name: rm: '(, ), -, " "'
*
* @name
* convert
*/
this.convertName = function(name) {
var conv = name && name.toLowerCase();
conv = Util.removeStr(conv, ['(', ')']);
conv = Util.replaceStr(conv, ' ', '-');
return conv;
};
this.escapeRegExp = function(pStr) {
var lRet = pStr,