Refactoring the regex codes

This commit is contained in:
Chris Cowan 2015-09-26 10:34:51 -07:00 committed by Court Ewing
parent 6b1e089937
commit 786e87bde5

View file

@ -18,11 +18,9 @@ module.exports = function applyFilterToKey(obj, key, action) {
}
else if (/\/.+\//.test(action)) {
var matches = action.match(/\/(.+)\//);
try {
if (matches) {
let regex = new RegExp(matches[1]);
obj[k] = ('' + val).replace(regex, replacer);
} catch (e) {
//meh
}
}
} else if (typeof val === 'object') {