@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))

Readme

Keywords

none

Package Sidebar

Install

npm i @frzr/inherit

Weekly Downloads

2

Version

0.0.1

License

MIT

Last publish

Collaborators

  • frzr