Permalink
Browse files

abbreviating the existential operator

  • Loading branch information...
1 parent 95b3624 commit 52539ae7d2875edf5292a8017d509b9473781ef2 @jashkenas jashkenas committed Jan 17, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/coffee_script/nodes.rb
@@ -595,7 +595,7 @@ def compile_conditional(o)
first, second = @first.compile(o), @second.compile(o)
o[:scope].find(first) if @first.unwrap.is_a?(Value)
sym = @operator[0..1]
- return "#{first} = (typeof #{first} !== \"undefined\" && #{first} !== null) ? #{first} : #{second}" if @operator == '?='
+ return "#{first} = (#{first} !== undefined && #{first} !== null) ? #{first} : #{second}" if @operator == '?='
"#{first} = #{first} #{sym} #{second}"
end

0 comments on commit 52539ae

Please sign in to comment.