-
Notifications
You must be signed in to change notification settings - Fork 50
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
Enable Bower API options #56
Conversation
Is there any reason not to pass the It can be done in combination with something like this: if (typeof options.offline === 'undefined') options.offline = true Btw, you do not need to create a new pull request when doing modifications. You can just update the branch you are creating the pull request from. |
Yeah, I think passing the options directly might be the way to go. |
I tend to prefer testing undefined / null this way: if (options.offline == null) options.offline = true; That catches both null and undefined. You can also simplyfy conditions that depened on if (options.offline !== false) doSomething That forces the default regardless of type or value unless |
the It's verbose, but nice and safe. You also want to make sure that the options object is an object as well, so you don't throw an error if the options object is undefined? |
Better? |
Testing typeof is only needed if your testing the existence of a possibly undeclared variable. Since all objects will return undefined for missing properties it's essentially superfluous. |
|
||
if (typeof options.bowerOptions === 'object') { | ||
bowerOptions = options.bowerOptions; | ||
} |
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.
Could just be:
bowerOptions = options.bowerOptions || {};
LGTM 👍 |
Thanks @JorritPosthuma for the PR! I've merged and published this as 1.2.0. I've also added you to the contributors list and giving you collaborate access to the repo as per our Open Open Source Contribution Policy. Cheers! |
I needed te be able to set the cwd option of the Bower API. This enables that.