Created
January 26, 2016 04:15
-
-
Save samme/15146f1047f6c3f0248e to your computer and use it in GitHub Desktop.
Object.assign
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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