createSuper.js 877 B

123456789101112131415161718192021222324252627
  1. var _Reflect$construct = require("@babel/runtime-corejs3/core-js/reflect/construct");
  2. var getPrototypeOf = require("./getPrototypeOf.js");
  3. var isNativeReflectConstruct = require("./isNativeReflectConstruct.js");
  4. var possibleConstructorReturn = require("./possibleConstructorReturn.js");
  5. function _createSuper(Derived) {
  6. var hasNativeReflectConstruct = isNativeReflectConstruct();
  7. return function _createSuperInternal() {
  8. var Super = getPrototypeOf(Derived),
  9. result;
  10. if (hasNativeReflectConstruct) {
  11. var NewTarget = getPrototypeOf(this).constructor;
  12. result = _Reflect$construct(Super, arguments, NewTarget);
  13. } else {
  14. result = Super.apply(this, arguments);
  15. }
  16. return possibleConstructorReturn(this, result);
  17. };
  18. }
  19. module.exports = _createSuper;
  20. module.exports["default"] = module.exports, module.exports.__esModule = true;