swc/packages/swc-helpers/src/_is_native_reflect_construct.mjs

11 lines
393 B
JavaScript
Raw Normal View History

2021-12-05 09:46:09 +03:00
export default function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () { }));
return true;
} catch (e) {
return false;
}
}