diff --git a/index.js b/index.js index a3849bce..ab9710c9 100644 --- a/index.js +++ b/index.js @@ -371,7 +371,10 @@ function parse (args, opts) { unsetDefaulted(key) if (/-/.test(key) && configuration['camel-case-expansion']) { - addNewAlias(key, camelCase(key)) + var alias = key.split('.').map(function (prop) { + return camelCase(prop) + }).join('.') + addNewAlias(key, alias) } var value = processValue(key, val) diff --git a/test/yargs-parser.js b/test/yargs-parser.js index 29104246..be260e16 100644 --- a/test/yargs-parser.js +++ b/test/yargs-parser.js @@ -1115,6 +1115,15 @@ describe('yargs-parser', function () { argv.fooBar.should.equal(99) }) + + // Fixes: https://github.com/yargs/yargs-parser/issues/77 + it('should combine dot-notation and camel-case expansion', function () { + var argv = parser(['--dot-notation.foo.bar']) + + argv.should.satisfy(function (args) { + return args.dotNotation.foo.bar + }) + }) }) it('should define option as boolean and set default to true', function () {