yargs-parser
Advanced tools
Comparing version 3.2.0 to 4.0.0
@@ -5,2 +5,17 @@ # Change Log | ||
<a name="4.0.0"></a> | ||
# [4.0.0](https://github.com/yargs/yargs-parser/compare/v3.2.0...v4.0.0) (2016-09-26) | ||
### Bug Fixes | ||
* coerce should be applied to the final objects and arrays created ([#57](https://github.com/yargs/yargs-parser/issues/57)) ([4ca69da](https://github.com/yargs/yargs-parser/commit/4ca69da)) | ||
### BREAKING CHANGES | ||
* coerce is no longer applied to individual arguments in an implicit array. | ||
<a name="3.2.0"></a> | ||
@@ -7,0 +22,0 @@ # [3.2.0](https://github.com/yargs/yargs-parser/compare/v3.1.0...v3.2.0) (2016-08-13) |
16
index.js
@@ -283,3 +283,3 @@ var assign = require('lodash.assign') | ||
applyEnvVars(argv, false) | ||
applyArrayCoercions(argv) | ||
applyCoercions(argv) | ||
applyDefaultsAndAliases(argv, flags.aliases, defaults) | ||
@@ -487,7 +487,5 @@ | ||
function applyArrayCoercions (argv) { | ||
function applyCoercions (argv) { | ||
var coerce | ||
Object.keys(argv).filter(function (key) { | ||
return key === '_' || checkAllAliases(key, flags.arrays) | ||
}).forEach(function (key) { | ||
Object.keys(argv).forEach(function (key) { | ||
coerce = checkAllAliases(key, flags.coercions) | ||
@@ -543,10 +541,2 @@ if (typeof coerce === 'function') { | ||
var key = keys[keys.length - 1] | ||
var coerce = !checkAllAliases(key, flags.arrays) && checkAllAliases(key, flags.coercions) | ||
if (typeof coerce === 'function') { | ||
try { | ||
value = coerce(value) | ||
} catch (err) { | ||
error = err | ||
} | ||
} | ||
@@ -553,0 +543,0 @@ if (value === increment) { |
{ | ||
"name": "yargs-parser", | ||
"version": "3.2.0", | ||
"version": "4.0.0", | ||
"description": "the mighty option parser used by yargs", | ||
@@ -32,4 +32,4 @@ "main": "index.js", | ||
"mocha": "^3.0.1", | ||
"nyc": "^7.1.0", | ||
"standard": "^7.1.0", | ||
"nyc": "^8.1.0", | ||
"standard": "^8.0.0", | ||
"standard-version": "^2.1.2" | ||
@@ -36,0 +36,0 @@ }, |
@@ -6,3 +6,3 @@ # yargs-parser | ||
[![NPM version](https://img.shields.io/npm/v/yargs-parser.svg)](https://www.npmjs.com/package/yargs-parser) | ||
[![Windows Tests](https://img.shields.io/appveyor/ci/bcoe/yargs-parser/master.svg?label=Windows%20Tests)](https://ci.appveyor.com/project/yargs/yargs-parser) | ||
[![Windows Tests](https://img.shields.io/appveyor/ci/bcoe/yargs-parser/master.svg?label=Windows%20Tests)](https://ci.appveyor.com/project/bcoe/yargs-parser) | ||
[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version) | ||
@@ -9,0 +9,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
33601
636