Nodejs Class Extend __extends(superClass)

Here you can find the source of __extends(superClass)

Method Source Code

Function.prototype.__extends = function(superClass) { 
    this.prototype = Object.create(superClass.prototype);
}; /*from   w  w w. j  a v a2  s  .  c  om*/

Object._entries = function(obj) {
    var entry = [];
    for (key in obj)
        entry[entry.length] = [key, obj[key]];
    
    return entry;
};

Related

  1. inherits(BaseClass)
    Function.prototype.inherits = function (BaseClass) {
      function Surrogate () {}
      Surrogate.prototype = BaseClass.prototype;
      this.prototype = new Surrogate();
      this.prototype.constructor = this;
    };
    String.prototype.capitalize = function() {
        return this.charAt(0).toUpperCase() + this.slice(1);
    };
    ...
    
  2. inheritsFrom(parent)
    Function.prototype.inheritsFrom = function(parent){ 
      this.prototype = new parent();
      this.prototype.constructor = this;
      this.prototype.parent = parent.prototype;
      return this;
    };
    
  3. Inherits(parent)
    Function.prototype.Inherits = function(parent) {
      this.prototype = new parent();
      this.prototype.constructor = this;
      this.prototype.parent = parent.prototype;
    };
    
  4. inherit(ParentClass)
    Function.prototype.inherit = function(ParentClass) {
      this.prototype = Object.create(ParentClass.prototype);
      this.prototype.constructor = this;
      this.prototype.parent = ParentClass.prototype;
    
  5. __extends(parent)
    Function.prototype.__extends = function(parent) {
        this.prototype = Object.create(parent.prototype);
    };
    
  6. Inherits(parent)
    Object.prototype.Inherits = function(parent) {
      if(arguments.length > 1) {
        parent.apply(this, Array.prototype.slice.call(arguments, 1) );
      } else {      
        parent.call(this);
    };
    
  7. extend()
    Object.prototype.extend = function(){
       var Obj = function(){};
       Obj.prototype = this;
       return new Obj();
    
  8. extend(destination, source)
    Object.extend = function(destination, source) {
      for (var property in source) {
        if (source.hasOwnProperty(property)) {
          destination[property] = source[property];
      return destination;
    };
    
  9. extend(destination, source)
    Object.extend = function(destination, source) {
      for (var property in source) {
        if (source.hasOwnProperty(property)) {
          destination[property] = source[property];
      return destination;