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

Coerce function returns option of type "number" as "string" #176

Closed
juergba opened this issue May 3, 2019 · 1 comment · Fixed by #182
Closed

Coerce function returns option of type "number" as "string" #176

juergba opened this issue May 3, 2019 · 1 comment · Fixed by #182
Labels

Comments

@juergba
Copy link
Contributor

juergba commented May 3, 2019

const parse = require('yargs-parser');

args = parse('--slow 5 --medium 10 --fast 15', {
    number: ['slow', 'medium', 'fast'],
    coerce: {
        'slow': val => val
    },
    configuration: {
        'parse-numbers': true // default anyway
    }
}
);
console.log(args);      // { _: [], slow: '5', medium: 10, fast: 15 }
@bcoe bcoe added the bug label May 6, 2019
@bcoe
Copy link
Member

bcoe commented May 6, 2019

@juergba thanks for the bug report 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants