Closed Sieniawsky closed 9 years ago
Verbose existence checks are not needed since CoffeeScript provides the ? operator.
?
For instance, reference this code.
return op[0].d if op[0].d isnt undefined
can be simplified as:
return op[0].d if op[0].d?
or further simplified:
return op[0].d? or 0 where 0 could be some default
return op[0].d? or 0
I used this where I could, in some places it gave me unwanted results.
Verbose existence checks are not needed since CoffeeScript provides the
?
operator.For instance, reference this code.
return op[0].d if op[0].d isnt undefined
can be simplified as:
return op[0].d if op[0].d?
or further simplified:
return op[0].d? or 0
where 0 could be some default