From 52539ae7d2875edf5292a8017d509b9473781ef2 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Sat, 16 Jan 2010 22:26:34 -0500 Subject: [PATCH] abbreviating the existential operator --- lib/coffee_script/nodes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/coffee_script/nodes.rb b/lib/coffee_script/nodes.rb index 525e1af6..84726d74 100644 --- a/lib/coffee_script/nodes.rb +++ b/lib/coffee_script/nodes.rb @@ -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