B2G/gecko/browser/components/tabview/modules/utils.jsm
// Pass several objects in and it will combine them all into the first object and return it.
Pass several objects in and it will combine them all into the first object and return it.
Pass several objects in and it will combine them all into the first object and return it .
function Utils_extend() {
    let target = arguments[0] || {};
    if (typeof target === "boolean") {
      this.assert(false, "The first argument of extend cannot be a boolean." +
          "Deep copy is not supported.");
      return target;
    }
    let length = arguments.length;
    if (length === 1) {
      this.assert(false, "Extending the iQ prototype using extend is not supported.");
      return target;
    }
    if (typeof target != "object" && typeof target != "function") {
      target = {};
    }
    for (let i = 1; i < length; i++) {
      let options = arguments[i];
      if (options != null) {
        for (let name in options) {
          let copy = options[name];
          if (target === copy)
            continue;
          if (copy !== undefined)
            target[name] = copy;
        }
      }
    }
    return target;
  }
function Utils_extend ( ) { let target = arguments [ 0 ] || { } ; if ( typeof target === "boolean" ) { this . assert ( false , "The first argument of extend cannot be a boolean." + "Deep copy is not supported." ) ; return target ; } let length = arguments . length ; if ( length === 1 ) { this . assert ( false , "Extending the iQ prototype using extend is not supported." ) ; return target ; } if ( typeof target != "object" && typeof target != "function" ) { target = { } ; } for ( let i = 1 ; i < length ; i ++ ) { let options = arguments [ i ] ; if ( options != null ) { for ( let name in options ) { let copy = options [ name ] ; if ( target === copy ) continue ; if ( copy !== undefined ) target [ name ] = copy ; } } } return target ; }
Pass several objects in and it will combine them all into the first object and return it.
Pass several objects in and it will combine them all into the first object and return it .
// copy reference to target object // Deep copy is not supported // Back when this was in iQ + iQ.fn, so you could extend iQ objects with it. // This is no longer supported. // Handle case when target is a string or something // Only deal with non-null/undefined values // Extend the base object // Prevent never-ending loop // Return the modified object