Skip to content
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

Merged
merged 1 commit into from
Jun 28, 2017
Merged

Added an option to toggle debug mode #18

merged 1 commit into from
Jun 28, 2017

Conversation

IvanKalinin
Copy link
Contributor

Added an option to toggle debug mode in babel-preset-env by using debug variable

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;
Copy link
Collaborator

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;

Copy link
Contributor Author

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

Copy link
Collaborator

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@ljharb ljharb left a 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.

@ljharb ljharb merged commit d97dd67 into airbnb:master Jun 28, 2017
ljharb added a commit that referenced this pull request Jun 28, 2017
 - [New] add “debug” option (#18)
 - [Fix] change “debug” output to default to false (#18)
@@ -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;
Copy link

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?

Copy link
Collaborator

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.

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.

3 participants