Simple classical inheritance.

Usage no npm install needed!

<script type="module">
  import defclass from '';



Simple classical inheritance that is a whopping ten lines. Its Augment without the augment.

In the words of Aadit Shah

No premature optimization. No need to read the documentation of libraries like ClassManager. I can directly focus on the task at hand and optimize those things that really need optimization.


const defclass = require('defclass');

const Beer = defclass({
  constructor: function (type) {
    this.type = type;
    this.count = 100;
    this.temp = 'cold';
  getADrink: function () {
    console.log(`Here's a ${this.temp} ${this.type}!`);

const favBeer = new Beer('Spotted Cow');
favBeer.getADrink(); // Here's a cold Spotted Cow!

If you need to inherit from another class use extend.

const GrabAnother = defclass.extend(Beer, {
  sing: function () {
    console.log(`${this.count} bottles of ${this.temp} ${this.type}'s on the wall.`);

const makeMeDance = new GrabAnother(`John's White Ale`);
makeMeDance.getADrink(); // Here's a John's White Ale!
makeMeDance.sing(); // 99 bottles of cold John's White Ale's on the wall.