Skip to content

Commit

Permalink
fix: use extact equality instead of index of
Browse files Browse the repository at this point in the history
  • Loading branch information
casserni committed Dec 3, 2018
1 parent e915bd9 commit 16e5992
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Expand Up @@ -60,7 +60,7 @@ interface IRunOpts {
}

export class Spectral {
// normalized object for holding rule definitions indexed by name
// normalized object for holding rule definitions indexed by ${format}-${name}
private _rulesByIndex: IRuleStore = {};

// the initial rule config, set on initialization
Expand All @@ -81,7 +81,7 @@ export class Spectral {
if (!this._rulesByIndex.hasOwnProperty(name)) continue;
const { rule, format, apply } = this._rulesByIndex[name];

if (!dataFormat || format.indexOf(dataFormat) !== -1) {
if (!dataFormat || format === dataFormat) {
rules.push({ name, format, rule, apply });
}
}
Expand Down Expand Up @@ -112,7 +112,7 @@ export class Spectral {
if (
!ruleEntry.rule.enabled ||
(opts.type && ruleEntry.rule.type !== opts.type) ||
ruleEntry.format.indexOf(opts.spec) === -1
ruleEntry.format !== opts.spec
) {
return null;
}
Expand Down

0 comments on commit 16e5992

Please sign in to comment.