Nodejs Class Inherit inheritsinherits(parent)

Here you can find the source of inheritsinherits(parent)

Method Source Code

// Object inheritance
Object.prototype.inherits = function inherits(parent) {
    if (typeof Object.create !== 'function') {
        Object.create = function (o) {
            function F() {}
            F.prototype = o;//from   www  .j  ava2s .  c  om
            return new F();
        };
    }

    this.prototype = Object.create(parent.prototype);
    this.prototype.constructor = this;
};

Related

  1. inheritsFrom( parentClassOrObject )
    Function.prototype.inheritsFrom = function( parentClassOrObject ){ 
      this.prototype.addPrototype( parentClassOrObject );
      if ( parentClassOrObject.constructor == Function ) 
        this.prototype.addPrototype( new parentClassOrObject );
        this.prototype.constructor = this;
        this.prototype.__parent__ = parentClassOrObject.prototype;
      else 
    ...
    
  2. deepExtend(destination, source)
    Object.deepExtend = function (destination, source) {
        for (var property in source) {
            if (source[property] && source[property].constructor &&
             source[property].constructor === Object) {
                destination[property] = destination[property] || {};
                arguments.callee(destination[property], source[property]);
            } else {
                destination[property] = source[property];
        return destination;
    };