-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: Add strict mode to parser #1
Conversation
index.js
Outdated
function storeOptionValue(options, arg, value, result) { | ||
const option = options[arg] || {}; | ||
function storeOptionValue(strict, options, arg, value, result) { | ||
let option = options[arg]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--toString
will incorrectly be accepted as an argument with this logic. Gotta use {}.hasOwnProperty.call(options, arg)
or similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great callout, thanks! ef06099
This update builds off PR #63 and adds a
strict
mode option to the parser. With the restructured options API, it becomes very simple to identify unknown long options, short options, short option groups, and options with explicit values.e.g.
TODO: Assuming we decide to move forward with this implementation
strict
mode