Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dashdash

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dashdash - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

17

CHANGES.md
# node-dashdash changelog
## 1.3.2
- Fix a subtlety where a *bool* option using both `env` and `default` didn't
work exactly correctly. If `default: false` then all was fine (by luck).
However, if you had an option like this:
options: [ {
names: ['verbose', 'v'],
env: 'FOO_VERBOSE',
'default': true, // <--- this
type: 'bool'
} ],
wanted `FOO_VERBOSE=0` to make the option false, then you need the fix
in this version of dashdash.
## 1.3.1

@@ -4,0 +21,0 @@

3

lib/dashdash.js

@@ -419,3 +419,3 @@ /**

this.options.forEach(function (o) {
if (o.default && opts[o.key] === undefined) {
if (o.default !== undefined && opts[o.key] === undefined) {
opts[o.key] = o.default;

@@ -425,3 +425,2 @@ }

opts._order = _order;

@@ -428,0 +427,0 @@ opts._args = _args;

{
"name": "dashdash",
"description": "A light, featureful and explicit option parsing library.",
"version": "1.3.1",
"version": "1.3.2",
"author": "Trent Mick (trentm.com)",

@@ -6,0 +6,0 @@ "repository": {

@@ -664,4 +664,48 @@ /*

},
{
options: [ {
names: ['verbose', 'v'],
env: 'FOO_VERBOSE',
'default': false,
type: 'bool'
} ],
argv: 'node foo.js',
expect: { verbose: false, _args: [] }
},
{
options: [ {
names: ['verbose', 'v'],
env: 'FOO_VERBOSE',
'default': false,
type: 'bool'
} ],
argv: 'node foo.js',
env: {FOO_VERBOSE: '1'},
expect: { verbose: true, _args: [] }
},
{
options: [ {
names: ['verbose', 'v'],
env: 'FOO_VERBOSE',
'default': false,
type: 'bool'
} ],
argv: 'node foo.js',
env: {FOO_VERBOSE: '0'},
expect: { verbose: false, _args: [] }
},
{
options: [ {
names: ['verbose', 'v'],
env: 'FOO_VERBOSE',
'default': false,
type: 'bool'
} ],
argv: 'node foo.js -v',
env: {FOO_VERBOSE: '0'},
expect: { verbose: true, _args: [] }
},
];
cases.forEach(function (c, i) {
cases.forEach(function (c, num) {
var expect = c.expect;

@@ -694,3 +738,3 @@ delete c.expect;

}
var testName = format('case %d: %s%s', i, envStr, argv.join(' '));
var testName = format('case %d: %s%s', num, envStr, argv.join(' '));
if (TEST_FILTER && !~testName.indexOf(TEST_FILTER)) {

@@ -700,3 +744,3 @@ return;

test(testName, function (t) {
debug('--', i)
debug('--', num)
debug('c: %j', c)

@@ -703,0 +747,0 @@ var parser = new dashdash.Parser(c);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc