diff --git a/.travis.yml b/.travis.yml index b1c8cf5bf..24c3795a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,5 @@ language: node_js -sudo: false node_js: -- "4.1" -- "4.0" -- "0.12" -- "0.11" -- "0.10" -- "iojs" - "6" - "7" - "8" @@ -19,10 +12,7 @@ before_script: - ./test/prism.sh - yarn prism & - sleep 5 # give it some time to start -install: -- npm install script: -- npm test - lerna bootstrap - yarn test:files - yarn test:license diff --git a/packages/mail/src/classes/mail-service.js b/packages/mail/src/classes/mail-service.js index 5992c4eac..4155ba6b5 100644 --- a/packages/mail/src/classes/mail-service.js +++ b/packages/mail/src/classes/mail-service.js @@ -59,35 +59,39 @@ class MailService { rules = [rules]; } - const tmpRules = rules.map(function (rule) { + const tmpRules = rules.map(function(rule) { const ruleType = typeof rule; if (ruleType === 'string') { return { - pattern: new RegExp(rule) + pattern: new RegExp(rule), }; - } else if (ruleType === 'object') { + } + else if (ruleType === 'object') { // normalize rule object if (rule instanceof RegExp) { rule = { - pattern: rule - } - } else if (rule.hasOwnProperty('pattern') + pattern: rule, + }; + } + else if (rule.hasOwnProperty('pattern') && (typeof rule.pattern === 'string') ) { - rule.pattern = new RegExp(rule.pattern); + rule.pattern = new RegExp(rule.pattern); } try { // test if rule.pattern is a valid regex rule.pattern.test(''); - return rule - } catch (err) { + return rule; + } + catch (err) { + // continue regardless of error } } }); - this.secretRules = tmpRules.filter(function (val) { + this.secretRules = tmpRules.filter(function(val) { return val; }); } @@ -102,8 +106,8 @@ class MailService { const self = this; - body.content.forEach(function (data) { - self.secretRules.forEach(function (rule) { + body.content.forEach(function(data) { + self.secretRules.forEach(function(rule) { if (rule.hasOwnProperty('pattern') && !rule.pattern.test(data.value) ) {