swc/packages/helpers/esm/_is_native_reflect_construct.js

15 lines
435 B
JavaScript
Raw Normal View History

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