Nodejs Class Extend extend(target)

Here you can find the source of extend(target)

Method Source Code

Object.extend = function(target) {
    Array.toArray(arguments, 1).forEach(function(source) {
        var fld;//from  w w  w.  j av a 2  s .co m
        for (fld in source) {
            if (source.hasOwnProperty(fld)) {
                target[fld] = source[fld];
            }
        }
    });
    return target;
};

Related

  1. extend(destination, source)
    Object.extend = function(destination, source) {
      for (var property in source) {
        if (source.hasOwnProperty(property)) {
          destination[property] = source[property];
      return destination;
    };
    
  2. extend(destination, source)
    Object.extend = function(destination, source) {
      for (var property in source) {
        if (source.hasOwnProperty(property)) {
          destination[property] = source[property];
      return destination;
    
  3. extend(obj)
    Object.prototype.extend = function(obj) {
       for (var i in obj) {
          if (obj.hasOwnProperty(i)) {
             this[i] = obj[i];
    };
    Array.prototype.first = function() {
        return this.length && this[0];
    ...
    
  4. extend(object)
    Object.prototype.extend = function (object)
      var combined = this;
      object.each( function (value, key)
        combined[key] = value;
      });
      return combined;
    };
    ...
    
  5. extend(other)
    Object.prototype.extend = function(other)
      let property;
      for (property in other)
        if( other.hasOwnProperty(property) &&
            other[property] != null )
          this[property] = other[property];
    ...