Reputation: 23
Here is my conditional expression in coffeescript
. How can I split it over multiple lines to make it more readable.
isWhat = (isAdd url) or (isUpdate url) or (isDelete url) or (isLockList url) or (isPasswordList url) or (isRemoteOpen url) or (isOpenRecord url)
Upvotes: 1
Views: 258
Reputation: 6548
In coffeescript you can split conditional expressions over multiple lines as long as you indent the continued expression one level so it knows to execute it as one expression.
It'll depend on your preference or style guide whether you put the or
at the end of the line, or the start of the next line.
I would also suggest wrapping the function arguments in parenthesis, rather than the whole function. This makes it easier to read, yet still prevents coffeescript from executing the or
before the function.
isWhat = isAdd(url) or
isUpdate(url) or
isDelete(url) or
isLockList(url) or
isPasswordList(url) or
isRemoteOpen(url) or
isOpenRecord(url)
Upvotes: 1