Created
December 21, 2011 17:54
-
-
Save hannahherbig/1506974 to your computer and use it in GitHub Desktop.
merge function
This file contains 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
_ = require 'underscore' | |
# merge all the objects together into one | |
# e.g. | |
# merge({ one: 1, two: 5 }, { two: 2 }) | |
# { one: 1, two: 2 } | |
merge = (objects...) -> | |
result = {} | |
for obj in objects | |
_(obj).each (value, key) -> | |
result[key] = value | |
result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment