We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is that possible ?
var opts = { "bloo" : [0, 1, 2] };
It seems --bloo 1 isn't accepted when i do that.
--bloo 1
The text was updated successfully, but these errors were encountered:
nopt is configured to work with types, not values. So, try:
"bloo" : Number // or "bloo" : [Array, Number]
Then handle the value conditions manually:
if (options.bloo > 0 && options.bloo < 3) { console.log("success"); } // or for (var i=0; i<options.bloo.length; i++) { if (options.bloo[i] > 0 && options.bloo[i] < 3) { console.log("success"); break; } }
Sorry, something went wrong.
@stevenvachon: (As of at least v3.0.1) it does work with values, at least with strings (there's an example in the read-me).
Not supporting it with numbers smells like a bug - unless I'm missing something.
Thus, here's a simple workaround: define your numbers as strings and convert afterward:
var opts = { "bloo" : ['0', '1', '2'] }; parsed = nopt(opts); // Convert to integer after parsing. if (parsed.bloo) parsed.bloo = parseInt(parsed.bloo, 10);
No branches or pull requests
Is that possible ?
It seems
--bloo 1
isn't accepted when i do that.The text was updated successfully, but these errors were encountered: