Multi-line support in ternary operator
sjuratov opened this issue · 2 comments
sjuratov commented
Is your feature request related to a problem? Please describe.
My variable is defined as follow (all single line).
var subscriptionRoles = (subscriptionRole == 'owner' ? '8e3af657-a8ff-443c-a75c-2fe8c4bcb635' : (subscriptionRole == 'contributor' ? 'b24988ac-6180-42a0-ab88-20f7382dd24c' : (subscriptionRole == 'reader' ? 'acdd72a7-3385-48ef-bd42-f606fba81ae7' : '')))
This works OK but it's really difficult to read and understand. subscriptionRole is parameter.
Describe the solution you'd like
I would like to format this one liner over a few lines for better readability. I've tried but getting squiggly line error.
Note: Please let me know if there is already another way to implement this, that is better readable.
anthony-c-martin commented
Great point, thanks for raising this! Linking this to #146 as the ternary operator is another important consideration for newline sensitivity.
alex-frankel commented
Closing as dup of #5829