Closed nhz-io closed 1 year ago
When I make that change, the test fails, so I'm not sure if your suggestion is correct. I've already removed the unused opts
in 62fde7d, but it can be added back in a PR if you think the test still needs fixing.
1) I think boolean and alias with chainable api
is currently identical functionally to the following boolean and alias with options hash
.
2) format of the unused opts
is completely wrong! It is inverted with key of herp
containing alias
and boolean
(like parseArgs
settled on). I wonder if it is left over from an earlier approach or something that was being considered at the time.
var opts = {
herp: { alias: 'h', boolean: true }
};
I don't see what "chainable API" refers to so I think the redundant test could be deleted, as unclear what different test was intended.
Regarding the alias - shouldn't it be bidirectional? (regardless what is aliased from).
isn't it that when h->herp
and herp = true
then h == true
and vice versa, when h = true
then also herp == true
?
I think the from
->
to
order shouldn't really matter. Am i wrong?
Checked the source, aliases are bidirectoinal:https://github.com/minimistjs/minimist/blob/62fde7d935f83417fb046741531a9e2346a36976/index.js#L52-L59
Yes you are right the aliases are bidirectional. But I am not sure what this affects? (My "inverted" comment?)
in
'boolean and alias with chainable api'
test: https://github.com/minimistjs/minimist/blob/980d7ac61a0b4bd552711251ac107d506b23e41f/test/bool.js#L42-L52the
opts
is redundant - it is not used. Instead opts are passed inline to parse (twice), with incorrect value forboolean
, which should betrue
instead of the name of the argument.opts
should be used instead of passing inline (as it done correctly in other tests)