From 38934de406344baf0bac9002cc5ce76a5df74f16 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sat, 15 Mar 2014 13:46:45 -0400 Subject: [PATCH] feature(util) add execOnMatch --- lib/util.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/util.js b/lib/util.js index 1d27d92b..2904ee2e 100644 --- a/lib/util.js +++ b/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