Skip to content

Commit

Permalink
feat: options/positionals with leading '+' and '0' no longer parse as…
Browse files Browse the repository at this point in the history
… numbers (yargs#1286)

BREAKING CHANGE: options with leading '+' or '0' now parse as strings
  • Loading branch information
bcoe committed Feb 2, 2019
1 parent ef16792 commit e9dc3aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -28,7 +28,7 @@
"string-width": "^3.0.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^12.0.0"
"yargs-parser": "^13.0.0"
},
"devDependencies": {
"chai": "^4.2.0",
Expand Down
7 changes: 7 additions & 0 deletions test/command.js
Expand Up @@ -1458,4 +1458,11 @@ describe('Command', () => {
return done()
})
})

// see: https://github.com/yargs/yargs/issues/1099
it('does not coerce number from positional with leading "+"', () => {
const argv = yargs.command('$0 <phone>', '', (yargs) => {})
.parse('+5550100')
argv.phone.should.equal('+5550100')
})
})

0 comments on commit e9dc3aa

Please sign in to comment.