Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

camelcased options using dot notation are turned to array when aliased #267

Closed
mleguen opened this issue Apr 15, 2020 · 0 comments · Fixed by #268
Closed

camelcased options using dot notation are turned to array when aliased #267

mleguen opened this issue Apr 15, 2020 · 0 comments · Fixed by #268

Comments

@mleguen
Copy link
Member

mleguen commented Apr 15, 2020

This is a follow-up of yargs/yargs#1620.

Reproduction code:

const parse = require('yargs-parser')
console.dir(parse('--filter-module.a 1 --filter-module.b 2', {
  alias: {
    'filter-module': ['f'],
  }
}))

Output:

$ node index.js
{
  _: [],
  'filter-module': { a: 1, b: 2 },
  filterModule: { a: [ 1, 1 ], b: [ 2, 2 ] },
  f: { a: 1, b: 2 }
}

Expected output:

$ node index.js
{
  _: [],
  'filter-module': { a: 1, b: 2 },
  filterModule: { a: 1, b: 2 },
  f: { a: 1, b: 2 }
}

This works fine when the f alias is removed.

EDIT: this works fine too when not using dot notation.

@mleguen mleguen changed the title camelcased options are turned to array when aliased camelcased options using dot notation are turned to array when aliased Apr 15, 2020
mleguen added a commit that referenced this issue Apr 15, 2020
mleguen added a commit that referenced this issue Apr 15, 2020
mleguen added a commit that referenced this issue Apr 15, 2020
@bcoe bcoe closed this as completed in #268 Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant