Marak / colors.js

get colors in your node.js console
https://github.com/Marak/colors.js
Other
5.17k stars 448 forks source link

Use ternary operator please #309

Open prietales opened 2 years ago

prietales commented 2 years ago

https://github.com/Marak/colors.js/blob/6bc50e79eeaa1d87369bb3e7e608ebed18c5cf26/lib/custom/trap.js#L39

jorgealbertojc commented 2 years ago

The best practices says that ternary operator is not a good idea.

prietales commented 2 years ago

Not always....

https://github.com/Marak/colors.js/blob/master/lib/system/supports-colors.js#L76

https://github.com/Marak/colors.js/blob/master/lib/system/supports-colors.js#L88

prietales commented 2 years ago

When if else only changes a variable is a bad practice, you should use ternary operator.

prietales commented 2 years ago

jorgealbertojc

The modern best practices says that "else" is not a good idea.

Potherca commented 2 years ago

jorgealbertojc

The modern best practices says that "else" is not a good idea.

The modern best practices says that both ternary operator and "else" is not a good idea.