yargs-parser
Advanced tools
Comparing version 15.0.0 to 16.0.0
@@ -5,2 +5,20 @@ # Changelog | ||
## [16.0.0](https://www.github.com/yargs/yargs-parser/compare/v15.0.0...v16.0.0) (2019-10-26) | ||
### ⚠ BREAKING CHANGES | ||
* moving to c8 for coverage and dropping Node 6 from build matrix (#209) | ||
### Bug Fixes | ||
* **unknown-options-as-args:** '--' is not an unknown option ([#207](https://www.github.com/yargs/yargs-parser/issues/207)) ([3fee2d8](https://www.github.com/yargs/yargs-parser/commit/3fee2d895e9da14af978bbd1c7c9c20170c3aa59)) | ||
* address issue with array options with array default values ([#206](https://www.github.com/yargs/yargs-parser/issues/206)) ([f5f9e5a](https://www.github.com/yargs/yargs-parser/commit/f5f9e5a7ea91821f7c95e8eb4c71dc74de1bc907)) | ||
* support negative numbers with decimal places ([#208](https://www.github.com/yargs/yargs-parser/issues/208)) ([850bbda](https://www.github.com/yargs/yargs-parser/commit/850bbdafcf8a4998f374dfce993422855d10716d)) | ||
### Build System | ||
* moving to c8 for coverage and dropping Node 6 from build matrix ([#209](https://www.github.com/yargs/yargs-parser/issues/209)) ([f3a9316](https://www.github.com/yargs/yargs-parser/commit/f3a9316e470b0cc5c01981c9614ee935835d719b)) | ||
## [15.0.0](https://github.com/yargs/yargs-parser/compare/v14.0.0...v15.0.0) (2019-10-07) | ||
@@ -7,0 +25,0 @@ |
23
index.js
@@ -54,3 +54,3 @@ var camelCase = require('camelcase') | ||
} | ||
var negative = /^-[0-9]+(\.[0-9]+)?/ | ||
var negative = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/ | ||
var negatedBoolean = new RegExp('^--' + configuration['negation-prefix'] + '(.+)') | ||
@@ -147,3 +147,4 @@ | ||
if (isUnknownOptionAsArg(arg)) { | ||
// any unknown option (except for end-of-options, "--") | ||
if (arg !== '--' && isUnknownOptionAsArg(arg)) { | ||
argv._.push(arg) | ||
@@ -210,3 +211,3 @@ // -- separated by = | ||
// dot-notation flag separated by space. | ||
} else if (arg.match(/^-.\..+/)) { | ||
} else if (arg.match(/^-.\..+/) && !arg.match(negative)) { | ||
next = args[i + 1] | ||
@@ -367,3 +368,3 @@ key = arg.match(/^-(.\..+)/)[1] | ||
for (ii = i + 1; ii < args.length; ii++) { | ||
if (!args[ii].match(/^-[^0-9]/) || isUnknownOptionAsArg(args[ii])) available++ | ||
if (!args[ii].match(/^-[^0-9]/) || args[ii].match(negative) || isUnknownOptionAsArg(args[ii])) available++ | ||
else break | ||
@@ -395,3 +396,4 @@ } | ||
if (defaults.hasOwnProperty(key)) { | ||
argsToSet.push(defaults[key]) | ||
const defVal = defaults[key] | ||
argsToSet = Array.isArray(defVal) ? defVal : [defVal] | ||
} | ||
@@ -756,12 +758,7 @@ } else { | ||
// check if a flag is set for any of a key's aliases. | ||
// return the 1st set flag for any of a key's aliases (or false if no flag set) | ||
function checkAllAliases (key, flag) { | ||
var isSet = false | ||
var toCheck = [].concat(flags.aliases[key] || [], key) | ||
toCheck.forEach(function (key) { | ||
if (flag.hasOwnProperty(key)) isSet = flag[key] | ||
}) | ||
return isSet | ||
let setAlias = toCheck.find(key => flag.hasOwnProperty(key)) | ||
return setAlias ? flag[setAlias] : false | ||
} | ||
@@ -768,0 +765,0 @@ |
{ | ||
"name": "yargs-parser", | ||
"version": "15.0.0", | ||
"version": "16.0.0", | ||
"description": "the mighty option parser used by yargs", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "nyc mocha test/*.js", | ||
"test": "c8 --reporter=text --reporter=html mocha test/*.js", | ||
"posttest": "standard", | ||
"coverage": "nyc report --reporter=text-lcov | coveralls", | ||
"coverage": "c8 report --reporter=text-lcov | coveralls", | ||
"release": "standard-version" | ||
@@ -29,6 +29,6 @@ }, | ||
"devDependencies": { | ||
"c8": "^6.0.0", | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.0.2", | ||
"mocha": "^5.2.0", | ||
"nyc": "^14.1.0", | ||
"standard": "^12.0.1", | ||
@@ -35,0 +35,0 @@ "standard-version": "^6.0.0" |
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
63013
858