Nodejs Class Extend extend(destination, source)

Here you can find the source of extend(destination, source)

Method Source Code

Object.extend = function(destination, source) {
  for (var property in source) {
    if (source.hasOwnProperty(property)) {
      destination[property] = source[property];
    }//  w  w w  .ja  v  a 2 s .  c  om
  }
  return destination;
};

Related

  1. inherit(ParentClass)
    Function.prototype.inherit = function(ParentClass) {
      this.prototype = Object.create(ParentClass.prototype);
      this.prototype.constructor = this;
      this.prototype.parent = ParentClass.prototype;
    
  2. __extends(parent)
    Function.prototype.__extends = function(parent) {
        this.prototype = Object.create(parent.prototype);
    };
    
  3. __extends(superClass)
    Function.prototype.__extends = function(superClass) { 
        this.prototype = Object.create(superClass.prototype);
    }; 
    Object._entries = function(obj) {
        var entry = [];
        for (key in obj)
            entry[entry.length] = [key, obj[key]];
        return entry;
    };
    ...
    
  4. Inherits(parent)
    Object.prototype.Inherits = function(parent) {
      if(arguments.length > 1) {
        parent.apply(this, Array.prototype.slice.call(arguments, 1) );
      } else {      
        parent.call(this);
    };
    
  5. extend()
    Object.prototype.extend = function(){
       var Obj = function(){};
       Obj.prototype = this;
       return new Obj();
    
  6. extend(destination, source)
    Object.extend = function(destination, source) {
      for (var property in source) {
        if (source.hasOwnProperty(property)) {
          destination[property] = source[property];
      return destination;
    
  7. 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];
    ...
    
  8. extend(object)
    Object.prototype.extend = function (object)
      var combined = this;
      object.each( function (value, key)
        combined[key] = value;
      });
      return combined;
    };
    ...
    
  9. extend(other)
    Object.prototype.extend = function(other)
      let property;
      for (property in other)
        if( other.hasOwnProperty(property) &&
            other[property] != null )
          this[property] = other[property];
    ...