1.0.0 • Published 6 years ago

@antigravities/abstract v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

abstract

Abstract classes in JavaScript, because why be a normal person?

Stolen from another project of mine and really only intended to be (re-)used by me, but I guess you can use it if you really want.

Install

npm install --save @antigravities/abstract

Use

const Abstract = require("@antigravities/abstract");

class Animal extends Abstract {
  constructor(){
    super(['makeNoise']);
  }
}

class Dog extends Animal {
  makeNoise(){
    console.log("woof");
  }
}

class Cat extends Animal {
  makeNoise(){
    console.log("meow");
  }
}

class Pig extends Animal { } // Error: Pig must implement makeNoise

License

MIT