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

[BUG] nopt breaks on arguments passed in as numbers #42

Open
cueedee opened this issue Apr 16, 2015 · 1 comment
Open

[BUG] nopt breaks on arguments passed in as numbers #42

cueedee opened this issue Apr 16, 2015 · 1 comment
Labels
Bug thing that needs fixing

Comments

@cueedee
Copy link

cueedee commented Apr 16, 2015

Please consider this minimal example:

node << _EOT_
var nopt   = require("nopt")
,   parsed = nopt( {}, {}, [ 123 ], 0 )
;
_EOT_

Output:

... /node_modules/nopt/lib/nopt.js:239
    if (arg.match(/^-{2,}$/)) {
            ^
TypeError: Object 123 has no method 'match'
    at parse ( ... /node_modules/nopt/lib/nopt.js:239:13)
    at nopt ( ... /node_modules/nopt/lib/nopt.js:40:3)

Contrived as this may seem, in the wild I found that yeoman-generator actually does this.

@djowatts
Copy link

I have made a little change to my local version of nopt that is working as a band aid for this with yeoman at the moment, and that was changing line 237 to var arg = args[i].toString(). This is in no means a permanent fix, but for the replacement of arguments when calling a yo command it seems to be working for me.

@darcyclarke darcyclarke changed the title nopt breaks on arguments passed in as numbers [BUG] nopt breaks on arguments passed in as numbers Jul 28, 2022
@darcyclarke darcyclarke added the Bug thing that needs fixing label Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing
Projects
None yet
Development

No branches or pull requests

3 participants