README
This is a simple utility for disallowing the use of "new" with certain functions. It's especially useful for when you have a capitalized factory function that you don't want people to use as a constructor (which would cause an unnecessary object allocation but otherwise succeed without warning).
Installation
npm install disallow-new
Usage
import disallowNew from 'disallow-new';
function MyFactory() {
// [SNIP]
}
export default disallowNew(MyFactory);
Elsewhere:
let a = new MyFactory(); // Errors!
let a = MyFactory(); // All good.