Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A library for deep (recursive) merging of Javascript objects

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 example
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.markdown
Octocat-spinner-32 index.js
Octocat-spinner-32 package.json
README.markdown

deepmerge

Merge the enumerable attributes of two objects deeply.

example

var merge = require('deepmerge')
var x = { foo : { 'bar' : 3 } }
var y = { foo : { 'baz' : 4 }, quux : 5 }
var merged = merge(x, y)
console.dir(merged)

output:

{ foo: { bar: 3, baz: 4 }, quux: 5 }

methods

var merge = require('deepmerge')

merge(x, y)

Merge two objects x and y deeply, returning a new merged object with the elements from both x and y.

If an element at the same key is present for both x and y, the value from y will appear in the result.

The merge is immutable, so neither x nor y will be modified.

install

With npm do:

npm install deepmerge

test

With npm do:

npm test
Something went wrong with that request. Please try again.