object-merge
Advanced tools
Comparing version 2.5.0 to 2.5.1
{ | ||
"name": "object-merge", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "Merges JavaScript objects recursively without altering the objects merged.", | ||
@@ -5,0 +5,0 @@ "main": "./src/object-merge.js", |
@@ -16,3 +16,3 @@ # object-merge | ||
In node: | ||
In Node: | ||
@@ -95,3 +95,39 @@ ``` | ||
merged recursively. | ||
### Options | ||
Options exist to do things like limit the depth of object traversal and disable | ||
errors on detection of circular references. In order to specify the options you | ||
must create an options object using the provided method `createOptions`, a | ||
normal object just won't work. | ||
``` | ||
var objectMerge = require('object-merge'); | ||
var a = { | ||
'a1' : { | ||
'a2' : { | ||
'a3' : {} | ||
} | ||
} | ||
}; | ||
var b = { | ||
'b1' : { | ||
'b2' : { | ||
'b3' : {} | ||
} | ||
} | ||
}; | ||
var opts = objectMerge.createOptions({depth : 2}); | ||
var res = objectMerge(opts, a, b); | ||
// res will be | ||
// { | ||
// 'a1' : { | ||
// 'a2' : {} | ||
// }, | ||
// 'b1' : { | ||
// 'b2' : {} | ||
// } | ||
// } | ||
``` | ||
See the tests in `browser/tests` for more examples and expected outputs. | ||
@@ -98,0 +134,0 @@ |
246688
168