UNPKG

tcomb

Version:

Type checking and DDD for JavaScript

6 lines (5 loc) 268 B
var assert = require('./assert'); var getTypeName = require('./getTypeName'); module.exports = function forbidNewOperator(x, type) { assert(!(x instanceof type), function () { return 'Cannot use the new operator to instantiate the type ' + getTypeName(type); }); };