Skip to content

Instantly share code, notes, and snippets.

@matthewhudson
Created September 16, 2013 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewhudson/6575957 to your computer and use it in GitHub Desktop.
Save matthewhudson/6575957 to your computer and use it in GitHub Desktop.
Simple clone() implemented in coffee
clone = (obj) ->
return obj if not obj? or typeof (obj) isnt "object"
tmp = obj.constructor()
for key of obj
tmp[key] = clone(obj[key])
tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment