6 lines
268 B
JavaScript
6 lines
268 B
JavaScript
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); });
|
|
}; |