is-constructor
Version:
Check if a value is a constructor function
16 lines (15 loc) • 406 B
JavaScript
function e(t) {
if (typeof t != "function" || !t.prototype || t.prototype.constructor !== t)
return !1;
if (/^class\s/.test(Function.prototype.toString.call(t)))
return !0;
try {
return Reflect.construct(String, [], t), !0;
} catch {
return !1;
}
}
typeof module < "u" && typeof module.exports < "u" && (module.exports = e, module.exports.default = e);
export {
e as default
};