minimistjs / minimist

parse argument options
MIT License
515 stars 30 forks source link

[patch]: include aliases when looking for defaults for booleans #32

Closed shadowspawn closed 1 year ago

shadowspawn commented 1 year ago

The starting values for boolean options are applied before parsing, whether false or a user supplied default. The check for user supplied defaults was not including aliases. Keep it simple and do in two passes using same alias detection logic as in existing code.

Fixes: #29

codecov-commenter commented 1 year ago

Codecov Report

Merging #32 (2758c33) into main (093bc85) will increase coverage by 0.03%. The diff coverage is 100.00%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main      #32      +/-   ##
==========================================
+ Coverage   98.75%   98.78%   +0.03%     
==========================================
  Files           1        1              
  Lines         161      165       +4     
  Branches       71       70       -1     
==========================================
+ Hits          159      163       +4     
  Misses          2        2              
Impacted Files Coverage Δ
index.js 98.78% <100.00%> (+0.03%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

shadowspawn commented 1 year ago

There is extra noise from refactoring aliasIsBoolean into isBooleanKey. I could do that refactor in a separate PR?

(I hadn't planned the refactor at the outset, but it made the changes tidier in all of #32 #33 #34.)

ljharb commented 1 year ago

If that refactor indeed doesn't require test changes, then at least a separate commit is good :-) whether it's a separate PR or not isn't important.

shadowspawn commented 1 year ago

Two commits now.

(In the order that makes sense afterwards, rather than the order the work happened. 😆 )

ljharb commented 1 year ago

(The order the work happened is always irrelevant, git has a changelog not a history :-p )