Created
July 1, 2014 22:42
-
-
Save kalupa/3174e31c54a2645ef776 to your computer and use it in GitHub Desktop.
Why I don't like ternaries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var borderStyle = borderApply ? | |
(borderApply.top === borderApply.left && borderApply.left === borderApply.bottom && borderApply.bottom === borderApply.right) ? | |
borderApply.top ? value.style : 'none' : | |
[ | |
borderApply.top ? value.style : 'none', | |
borderApply.right ? value.style : 'none', | |
borderApply.bottom ? value.style : 'none', | |
borderApply.left ? value.style : 'none' | |
].join(' ') : value === null ? 'none' : value.style; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment