object-to-class
Generate a dynamically named es6 class from any JS object.
Install
Node
npm i object-to-class
Usage
Simply pass the object you wish to convert to a class, and an optional name.
const o2c = const myObj = 'prop': 'my property' { return 'my function' }const MyClass = MyClassname // MyClassconst myinst = myinstprop // my propertymyinst // my function
The result can be used like any other ES6 class, with normal inheritance.
{}let myinst = mysubinst instanceof MyClass // truemysubinstprop // my propertymysubinst // my function
License
MIT Copyright isysd public@iramiller.com