Nodejs Class Extend extend(object)

Here you can find the source of extend(object)

Method Source Code

Object.prototype.extend = function (object)
{
   var combined = this;

   object.each( function (value, key)
   {//from  w w w.j  a  va  2  s  .co m
      combined[key] = value;
   });

   return combined;
};

Related

  1. Inherits(parent)
    Object.prototype.Inherits = function(parent) {
      if(arguments.length > 1) {
        parent.apply(this, Array.prototype.slice.call(arguments, 1) );
      } else {      
        parent.call(this);
    };
    
  2. extend()
    Object.prototype.extend = function(){
       var Obj = function(){};
       Obj.prototype = this;
       return new Obj();
    
  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(destination, source)
    Object.extend = function(destination, source) {
      for (var property in source) {
        if (source.hasOwnProperty(property)) {
          destination[property] = source[property];
      return destination;
    
  5. 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];
    ...
    
  6. extend(other)
    Object.prototype.extend = function(other)
      let property;
      for (property in other)
        if( other.hasOwnProperty(property) &&
            other[property] != null )
          this[property] = other[property];
    ...
    
  7. 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];
        });
    ...