Allows to create an Instance from a JavaScript Class without invoking new
keyword.
npm i class-nonew-decorator --save
import nonew from 'class-nonew-decorator';
@nonew()
class IamClass {
constructor() {
console.log('IamClass Instance!');
}
}
console.log(new IamClass() instanceof IamClass); // true
console.log(IamClass() instanceof IamClass); // true
const nonew = require('class-nonew-decorator');
@nonew()
class IamClass {
constructor() {
console.log('IamClass Instance!');
}
}
console.log(new IamClass() instanceof IamClass); // true
console.log(IamClass() instanceof IamClass); // true