Is there any coffeescript specific trickery that would make this look neater:
index = (->
if segment == 'index'
return 0
else if segment == 'inbox'
return 2
1
)()
Yes, a switch expression:
index = switch segment
when 'index' then 0
when 'inbox' then 2
else 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With