js-class-extender

Extend javascript classes

Usage no npm install needed!

<script type="module">
  import jsClassExtender from 'https://cdn.skypack.dev/js-class-extender';
</script>

README

How to use

const { extend } = require("extender")
const Class = require("somewherethathasclasses")
const newClass = extend(Class, { newThing: "yes", newThing1: "yes1" })({ thing: 1 } /*options for the old class*/)

And new class will come out as:

{
    oldthing: "oldthing",
    secondoldthing: "oldthing2",
    newThing: "yes",
    newThing1: "yes1"
}