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

Shorthand if/else statement #158

Closed
ricardofbarros opened this issue Jun 15, 2015 · 3 comments

Comments

@ricardofbarros
Copy link
Contributor

commented Jun 15, 2015

Shouldn't this be allowed?

var state = plug.currentState.toLowerCase() === 'off' ? false : true

In the newest version 4.x.x standard is outputting this:

  • Unnecessary use of boolean literals in conditional expression
@sindresorhus

This comment has been minimized.

Copy link

commented Jun 15, 2015

Should be: var state = plug.currentState.toLowerCase() !== 'off'

@julien-f

This comment has been minimized.

Copy link

commented Jun 15, 2015

Edit: My code is ugly, see @sindresorhus' code.

@ricardofbarros

This comment has been minimized.

Copy link
Contributor Author

commented Jun 15, 2015

Thank you both, I completely forgot I could do that.

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants
You can’t perform that action at this time.