Skip to content

Instantly share code, notes, and snippets.

@hanachin
Forked from superbrothers/gist:1396882
Created November 30, 2011 17:05
Show Gist options
  • Save hanachin/1409828 to your computer and use it in GitHub Desktop.
Save hanachin/1409828 to your computer and use it in GitHub Desktop.
# 1
data = if obj.data? then ("#{key}=#{value}" for key, value of obj.data).join "&" else null
# 2
data = if obj.data?
("#{key}=#{value}" for key, value of obj.data).join "&"
else
null
# 3
data = if obj.data?
(for own key, value of obj.data
"#{key}=#{value}"
).join "&"
else
null
# 4
data = ((("#{key}=#{value}" for key, value of obj.data).join "&" if obj.data?) ? null)
# 5
data = ("#{key}=#{value}" for key, value of obj.data).join "&" if obj.data?
data ?= null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment