-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fleshing out parseArgs to support withValue and Multiples options (#9)
* feat(parseArgs): set positionals and handle withValue with multiples options This PR handles: 1. setting values for args only if the arg is specified in the options.withValue array 2. set arg value to undefined if withValue isn't specified 3. add args without a dashprefix to the positionals array 4. handle only recording the last value for the arg, in the case of multiple values set for same arg 5. in the case of multiple values set for the same arg, and 'multiples' options having been set, handle recording all values for the arg in the returned array 6. Introduces new test cases covering readme examples, withValue, multiples, and error throwing bad input cases * Revert "feat(parseArgs): set positionals and handle withValue with multiples options" This reverts commit 4486551. * feat(parseArgs): set positionals and handle withValue with multiples * chore: add more comments * chore(parse-args): resolve type checking on withValue to handle false,0,null,nan,'' cases * chore(parseargs): fix formatting on line 10 Co-authored-by: Jordan Harband <[email protected]> * chore(parseargs): optimize line 48 following suggestion Co-authored-by: Jordan Harband <[email protected]> * chore(parseargs): optimize lines 61 and 66 following suggestion Co-authored-by: Jessica Nahulan <[email protected]> Co-authored-by: Jordan Harband <[email protected]>
- Loading branch information
1 parent
0f40fa0
commit 9f1fb30
Showing
2 changed files
with
91 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters