modules/utils.js
function mergeObjectsInGecko(origin, add, opts) {
    "use strict";

    var options = opts || {},
        keepReferences = options.keepReferences;

    for (var p in add) {
        if (isPlainObject(add[p])) {
            if (isPlainObject(origin[p])) {
                origin[p] = mergeObjects(origin[p], add[p]);
            } else {
                origin[p] = keepReferences ? add[p] : clone(add[p]);
            }
        } else {
            // if a property is only a getter, we could have a Javascript error
            // in strict mode "TypeError: setting a property that has only a getter"
            // when setting the value to the new object (gecko 25+).
            // To avoid it, let's define the property on the new object, do not set
            // directly the value
            var prop = Object.getOwnPropertyDescriptor(add, p);
            if (prop.get && !prop.set) {
                Object.defineProperty(origin, p, prop);
            }
            else {
                origin[p] = add[p];
            }
        }
    }
    return origin;
}
function mergeObjectsInGecko(origin, add, opts) {
    "use strict";

    var options = opts || {},
        keepReferences = options.keepReferences;

    for (var p in add) {
        if (isPlainObject(add[p])) {
            if (isPlainObject(origin[p])) {
                origin[p] = mergeObjects(origin[p], add[p]);
            } else {
                origin[p] = keepReferences ? add[p] : clone(add[p]);
            }
        } else {
            // if a property is only a getter, we could have a Javascript error
            // in strict mode "TypeError: setting a property that has only a getter"
            // when setting the value to the new object (gecko 25+).
            // To avoid it, let's define the property on the new object, do not set
            // directly the value
            var prop = Object.getOwnPropertyDescriptor(add, p);
            if (prop.get && !prop.set) {
                Object.defineProperty(origin, p, prop);
            }
            else {
                origin[p] = add[p];
            }
        }
    }
    return origin;
}
function mergeObjectsInGecko ( origin , add , opts ) { "use strict" ; var options = opts || { } , keepReferences = options . keepReferences ; for ( var p in add ) { if ( isPlainObject ( add [ p ] ) ) { if ( isPlainObject ( origin [ p ] ) ) { origin [ p ] = mergeObjects ( origin [ p ] , add [ p ] ) ; } else { origin [ p ] = keepReferences ? add [ p ] : clone ( add [ p ] ) ; } } else { // if a property is only a getter, we could have a Javascript error // in strict mode "TypeError: setting a property that has only a getter" // when setting the value to the new object (gecko 25+). // To avoid it, let's define the property on the new object, do not set // directly the value var prop = Object . getOwnPropertyDescriptor ( add , p ) ; if ( prop . get && ! prop . set ) { Object . defineProperty ( origin , p , prop ) ; } else { origin [ p ] = add [ p ] ; } } } return origin ; }
Object recursive merging utility for use in the SlimerJS environment

@param  Object  origin  the origin object
@param  Object  add     the object to merge data into origin
@param  Object  opts    optional options to be passed in
@return Object
Object recursive merging utility for use in the SlimerJS environment