mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(util) add execOnMatch
This commit is contained in:
parent
b9f8f9589d
commit
38934de406
1 changed files with 13 additions and 0 deletions
13
lib/util.js
13
lib/util.js
|
|
@ -823,6 +823,19 @@
|
|||
return ret;
|
||||
};
|
||||
|
||||
this.execOnMatch = function(exp, funcsObj) {
|
||||
var name, func, match;
|
||||
|
||||
if (funcsObj)
|
||||
for (name in funcsObj) {
|
||||
match = name.match(new RegExp(exp));
|
||||
func = funcsObj[name];
|
||||
|
||||
if (isMatch)
|
||||
Util.exec(func, match);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* exec function if it exist in object
|
||||
* @pArg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue