Nodejs Class Extend extend(other)

Here you can find the source of extend(other)

Method Source Code

// Copy properties from [other] to [this] object.
Object.prototype.extend = function(other)
{
   let property;/* w w  w.  j a v a  2s  . c  om*/

   for (property in other)
   {
      if( other.hasOwnProperty(property) &&
          other[property] != null )
      {
         this[property] = other[property];
      }
   }

   return this;
};

Related

  1. extend()
    Object.prototype.extend = function(){
       var Obj = function(){};
       Obj.prototype = this;
       return new Obj();
    
  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(destination, source)
    Object.extend = function(destination, source) {
      for (var property in source) {
        if (source.hasOwnProperty(property)) {
          destination[property] = source[property];
      return destination;
    
  4. 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];
    ...
    
  5. extend(object)
    Object.prototype.extend = function (object)
      var combined = this;
      object.each( function (value, key)
        combined[key] = value;
      });
      return combined;
    };
    ...
    
  6. extend(target)
    Object.extend = function(target) {
        Array.toArray(arguments, 1).forEach(function(source) {
            var fld;
            for (fld in source) {
                if (source.hasOwnProperty(fld)) {
                    target[fld] = source[fld];
        });
    ...