Skip to content

Instantly share code, notes, and snippets.

@samme
Created January 26, 2016 04:15
Show Gist options
  • Save samme/15146f1047f6c3f0248e to your computer and use it in GitHub Desktop.
Save samme/15146f1047f6c3f0248e to your computer and use it in GitHub Desktop.
Object.assign
Object.assign ?= (target, sources...) ->
unless target?
throw new TypeError "Cannot convert undefined or null to object"
output = Object target
for source in sources when source?
for own key of source
output[key] = source[key]
output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment