Skip to content

Instantly share code, notes, and snippets.

@kalupa
Created July 1, 2014 22:42
Show Gist options
  • Save kalupa/3174e31c54a2645ef776 to your computer and use it in GitHub Desktop.
Save kalupa/3174e31c54a2645ef776 to your computer and use it in GitHub Desktop.
Why I don't like ternaries
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