diff --git a/index.js b/index.js index 25943502..83c69c2c 100644 --- a/index.js +++ b/index.js @@ -497,7 +497,7 @@ function parse (args, opts) { o[key] = increment(o[key]) } else if (o[key] === undefined && checkAllAliases(key, flags.arrays)) { o[key] = Array.isArray(value) ? value : [value] - } else if (o[key] === undefined || typeof o[key] === 'boolean') { + } else if (o[key] === undefined || checkAllAliases(key, flags.bools)) { o[key] = value } else if (Array.isArray(o[key])) { o[key].push(value) diff --git a/test/yargs-parser.js b/test/yargs-parser.js index 00e5b53d..0858b19d 100644 --- a/test/yargs-parser.js +++ b/test/yargs-parser.js @@ -879,7 +879,7 @@ describe('yargs-parser', function () { }) describe('for boolean options', function () { - [true, false, undefined].forEach(function (def) { + [true, false, undefined, null].forEach(function (def) { describe('with explicit ' + def + ' default', function () { var opts = { default: {