diff --git a/opter.js b/opter.js index 5591aac..bc83b21 100644 --- a/opter.js +++ b/opter.js @@ -51,8 +51,8 @@ module.exports = class Opts { const name = stripDashes(nameWithDashes); if (name in this.opts) return true; if (name in this.synonyms) { - let syns = this.synonyms[name]; - let hits = syns.filter(s => s in this.opts ).length; + const syns = this.synonyms[name]; + const hits = syns.filter(s => s in this.opts ).length; if (hits > 0) { return true; } } throw new Error(errorMessage || defaultErrorMessages.missingRequiredOption(nameWithDashes)); @@ -94,7 +94,11 @@ module.exports = class Opts { contains(nameWithDashes) { const name = stripDashes(nameWithDashes); if (name in this.opts) return true; - if (name in this.synonyms) return true; // FIXME + if (name in this.synonyms) { + const syns = this.synonyms[name]; + const hits = syns.filter(s => s in this.opts ).length; + if (hits > 0) { return true; } + } return false; } }