Comparing version 1.1.0 to 1.1.1
@@ -39,3 +39,3 @@ { | ||
}, | ||
"version": "1.1.0" | ||
"version": "1.1.1" | ||
} |
@@ -302,3 +302,2 @@ argly | ||
* Support number arg: `-x256` | ||
* Detect repeated declared options and throw an error | ||
@@ -305,0 +304,0 @@ # Additional Reading |
@@ -166,3 +166,9 @@ var optionRegExp = /^--?(.+)$/; | ||
for (var i = 0, len = aliases.length; i < len; i++) { | ||
this._lookup[aliases[i]] = optionConfig; | ||
var alias = aliases[i]; | ||
if (this._lookup[alias]) { | ||
throw new Error("Duplicate option provided '" + alias + "'"); | ||
} | ||
this._lookup[alias] = optionConfig; | ||
} | ||
@@ -169,0 +175,0 @@ } |
@@ -307,2 +307,22 @@ 'use strict'; | ||
}); | ||
it('should throw error if repeated option provided in parser', function() { | ||
expect(function() { | ||
require('../') | ||
.createParser({ | ||
'--minify -m': 'boolean', | ||
'--minify -t': 'boolean' | ||
}); | ||
}).to.throw(/Duplicate option provided \'--minify\'/); | ||
}); | ||
it('should throw error if repeated alias provided in parser', function() { | ||
expect(function() { | ||
require('../') | ||
.createParser({ | ||
'--minify -m': 'boolean', | ||
'--test -m': 'boolean' | ||
}); | ||
}).to.throw(/Duplicate option provided \'-m\'/); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34441
686
310