mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 01:17:18 +00:00
feature(util) add convertName
This commit is contained in:
parent
c969fa59ba
commit
1d7409dd14
2 changed files with 15 additions and 4 deletions
|
|
@ -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,
|
||||
|
|
|
|||
14
lib/util.js
14
lib/util.js
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue