mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 03:21:20 -05:00
abbreviating the existential operator
This commit is contained in:
@@ -595,7 +595,7 @@ module CoffeeScript
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user