@slick-for/builder

use this module to create builder classes. You can swap out the implementation pretty easily.

Usage no npm install needed!

<script type="module">
  import slickForBuilder from 'https://cdn.skypack.dev/@slick-for/builder';
</script>

README

Slick-For/builder

use this module to create builder classes. You can swap out the implementation pretty easily.


@builder
class Person{

    constructor(){

    }
    speak(){
        return "hello"
    }
}

@builder
class Woman extends Person{
    speak(){
        return "well, hello"
    }
}

You can get the instance of person as such

    const words = Factory.get(Person).speak()
    expect(words).toBe("hello")

Swap to a different implementation

    Factory.use(Person,Woman);
    const words = Factory.get(Person).speak()
    expect(words).toBe("well, hello")