fix: inner objects in configs had their keys appended to top-level ke… · yargs/yargs-parser@0b1b5f9

Original file line numberDiff line numberDiff line change

@@ -452,7 +452,10 @@ function parse (args, opts) {

452452

var value = config[key]

453453

var fullKey = prev ? prev + '.' + key : key

454454
455-

if (Object.prototype.toString.call(value) === '[object Object]') {

455+

// if the value is an inner object and we have dot-notation

456+

// enabled, treat inner objects in config the same as

457+

// heavily nested dot notations (foo.bar.apple).

458+

if (typeof value === 'object' && !Array.isArray(value) && configuration['dot-notation']) {

456459

// if the value is an object but not an array, check nested object

457460

setConfigObject(value, fullKey)

458461

} else {