3 ms·
What a disgusting way to format ternaries, nested or not. No wonder it looks like a mess when you format like that, its like the author is going out of his way
by YourMistake 3y ago
What a disgusting way to format ternaries, nested or not. No wonder it looks like a mess when you format like that, its like the author is going out of his way to find the most ugly, messy way to style the code.
While I agree that ternaries generally shouldnt be nested for readability, the way the author formats his code, does ternaries a huge disservice:
Sane, normal people:
const animalName =
pet.canBark()
? pet.isScary()
? 'wolf'
: 'dog'
: pet.canMeow()
? 'cat'
: 'probably a bunny';
Vs the style of the author:
const animalName =
pet.canBark() ?
pet.isScary() ?
'wolf'
: 'dog'
: pet.canMeow() ? 'cat'
: 'probably a bunny';