Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hannahherbig
Created December 21, 2011 17:54
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 hannahherbig/1506974 to your computer and use it in GitHub Desktop.
Save hannahherbig/1506974 to your computer and use it in GitHub Desktop.
merge function
_ = 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