@antigravities/abstract

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

Usage no npm install needed!

<script type="module">
  import antigravitiesAbstract from 'https://cdn.skypack.dev/@antigravities/abstract';
</script>

README

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