Neurosis Prevention Mechanism
    Wondering what’s next for npm?Check out our public roadmap! »

    @frzr/inherit

    0.0.1 • Public • Published

    inherit

    simple class inheritance

    install

    npm install @frzr/inherit
    

    example

    var inherit = require('@frzr/inherit')
    
    function Model () {
      console.log('constructor works')
      Model.super.call(this)
    }
    
    function SuperModel () {
      console.log('super call works')
    }
    
    inherit(Model, SuperModel)
    
    Model.prototype.proto = function () {
      console.log('proto works')
    }
    SuperModel.prototype.superproto = function () {
      console.log('inherited proto works')
    }
    
    var model = new Model()
    
    model.proto()
    model.superproto()
    
    console.log('is SuperModel:' + (model instanceof SuperModel))
    

    Keywords

    none

    Install

    npm i @frzr/inherit

    DownloadsWeekly Downloads

    9

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • avatar