Class Index | File Index

Classes


Built-In Namespace _global_

Method Summary
Method Attributes Method Name and Description
 
objectMerge(shadows)
Merges JavaScript objects recursively without altering the objects merged.
Method Detail
{Object} objectMerge(shadows)
Merges JavaScript objects recursively without altering the objects merged.
Defined in: <src/object-merge.js>.
Author: Matthew Kastor.
 var objectMerge = require('object-merge');
 var x = {
     a : 'a',
     b : 'b',
     c : {
         d : 'd',
         e : 'e',
         f : {
             g : 'g'
         }
     }
 };
 var y = {
     a : '`a',
     b : '`b',
     c : {
         d : '`d'
     }
 };
 var z = {
     a : {
         b : '``b'
     },
     fun : function foo () {
         return 'foo';
     },
     aps : Array.prototype.slice
 };
 var out = objectMerge(x, y, z);
 // out.a will be {
 //         b : '``b'
 //     }
 // out.b will be '`b'
 // out.c will be {
 //         d : '`d',
 //         e : 'e',
 //         f : {
 //             g : 'g'
 //         }
 //     }
 // out.fun will be a clone of z.fun
 // out.aps will be equal to z.aps
Parameters:
{Object} shadows
[[shadows]...] One or more objects to merge. Each argument given will be treated as an object to merge. Each object overwrites the previous objects descendant properties if the property name matches. If objects properties are objects they will be merged recursively as well.
Returns:
{Object} Returns a single merged object composed from clones of the input objects.

Documentation generated by JsDoc Toolkit 2.4.0 on Sat Dec 21 2013 11:58:17 GMT-0500 (Eastern Standard Time)