construct.js 987 B

123456789101112131415161718192021222324
  1. var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
  2. var setPrototypeOf = require("./setPrototypeOf.js");
  3. var isNativeReflectConstruct = require("./isNativeReflectConstruct.js");
  4. function _construct(Parent, args, Class) {
  5. if (isNativeReflectConstruct()) {
  6. module.exports = _construct = _Reflect$construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  7. } else {
  8. module.exports = _construct = function _construct(Parent, args, Class) {
  9. var a = [null];
  10. a.push.apply(a, args);
  11. var Constructor = Function.bind.apply(Parent, a);
  12. var instance = new Constructor();
  13. if (Class) setPrototypeOf(instance, Class.prototype);
  14. return instance;
  15. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  16. }
  17. return _construct.apply(null, arguments);
  18. }
  19. module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;