Skip to content

Commit

Permalink
feat(Match): support strict option
Browse files Browse the repository at this point in the history
  • Loading branch information
Clunt committed May 29, 2018
1 parent 1321147 commit 2681681
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Match.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const VAR = require('./VAR');

function Match(option, rules) {
this.option = option;
this.strict = option.strict;
this.rules = [];
this.init(rules);
}
Expand Down Expand Up @@ -100,9 +101,15 @@ Match.prototype.init = function (release) {
};

Match.prototype.test = function (path) {
if (this.rules.length === 0) {
return this.strict ? VAR.TEST_STAT.UNRELEASE_UNMATCHED : VAR.TEST_STAT.RELEASE;
}

const matchMode = this.option.match;

let release = false;
let matched = false;

this.rules.forEach(rule => {
const stat = rule.test(path);
switch (stat) {
Expand Down

0 comments on commit 2681681

Please sign in to comment.