-
Notifications
You must be signed in to change notification settings - Fork 48
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
Added an option to toggle debug mode #18
Conversation
index.js
Outdated
@@ -24,10 +24,12 @@ module.exports = function buildAirbnbPreset(context, options) { | |||
var transpileTargets = (options && options.targets) || | |||
buildTargets(options || {}); | |||
|
|||
var debug = options.debug !== undefined ? options.debug : true; |
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.
i think it'd actually be better to default it to false
- ie, var debug = typeof options.debug === 'boolean' ? ‼options.debug : false;
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.
I've switched to false by default.
But I don't really get why should we use !!
before options.debug
. After all if type of options.debug is boolean then the value is (bool) true
or (bool) false
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.
LGTM
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.
This is breaking tests for us downstream, so I'm going to merge and release it.
@@ -24,10 +24,12 @@ module.exports = function buildAirbnbPreset(context, options) { | |||
var transpileTargets = (options && options.targets) || | |||
buildTargets(options || {}); | |||
|
|||
var debug = (options && typeof options.debug === 'boolean') ? !!options.debug : false; |
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.
If type of options.debug
is boolean, it is redundant to double negate it, isn't it?
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.
Sure, that's a fair point. Doesn't hurt tho.
Added an option to toggle debug mode in babel-preset-env by using debug variable