Skip to content

Allow int arg to be 0#49

Merged
leo merged 3 commits intoleo:masterfrom
pablopunk:master
Jan 8, 2017
Merged

Allow int arg to be 0#49
leo merged 3 commits intoleo:masterfrom
pablopunk:master

Conversation

@pablopunk
Copy link
Copy Markdown
Contributor

This should solve vercel/serve#57

Basically when passing a value of 0 to a integer arg, the value would be set to default

Before

node example.js --cache 0 # sets cache to default value

After

node example.js --cache 0 # sets cache to 0

let propVal = value
if (typeof option.defaultValue !== 'undefined' && typeof propVal !== typeof option.defaultValue) {
propVal = option.defaultValue
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add an empty line here?

// Process the option's value
for (let name of option.usage) {
let propVal = value || option.defaultValue
let propVal = value
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add an empty line here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leo done 👍

@leo leo merged commit 94e2f21 into leo:master Jan 8, 2017
@leo
Copy link
Copy Markdown
Owner

leo commented Jan 8, 2017

Thanks a lot!

leo pushed a commit that referenced this pull request May 1, 2022
* Allow int value to be 0

* Add emtpy lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants