object-class

Expose `prototype` and `static` method of class

Usage no npm install needed!

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

README

object-class Build Status

Expose prototype and static method of class

Install

$ npm install --save object-class

Usage

const objectClass = require('object-class');

class Foo {
    constructor() {
        this.props = 'bar';
    }
    static staticMethod1() {}
    static staticMethod2() {}
    prototypeMethod1() {}
    prototypeMethod2() {}
}

console.log(Foo);
//=> [Function: Foo]

console.log(new Foo());
//=> Foo { props: 'bar' }

console.log(objectClass.staticOf(Foo));
//=> ['staticMethod1', 'staticMethod2']

console.log(objectClass.prototypeOf(Foo));
//=> ['prototypeMethod1', 'prototypeMethod2']

API

objectClass.staticOf(input)

Returns an array from function name of input

objectClass.prototypeOf(input)

Returns an array from function name of input

input

Type: function

License

MIT © Guntur Poetra