interopRequireWildcard.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. var _typeof = require("@babel/runtime-corejs3/helpers/typeof")["default"];
  2. var _WeakMap = require("@babel/runtime-corejs3/core-js/weak-map");
  3. var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
  4. var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor");
  5. function _getRequireWildcardCache(nodeInterop) {
  6. if (typeof _WeakMap !== "function") return null;
  7. var cacheBabelInterop = new _WeakMap();
  8. var cacheNodeInterop = new _WeakMap();
  9. return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
  10. return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
  11. })(nodeInterop);
  12. }
  13. function _interopRequireWildcard(obj, nodeInterop) {
  14. if (!nodeInterop && obj && obj.__esModule) {
  15. return obj;
  16. }
  17. if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
  18. return {
  19. "default": obj
  20. };
  21. }
  22. var cache = _getRequireWildcardCache(nodeInterop);
  23. if (cache && cache.has(obj)) {
  24. return cache.get(obj);
  25. }
  26. var newObj = {};
  27. var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor;
  28. for (var key in obj) {
  29. if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
  30. var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null;
  31. if (desc && (desc.get || desc.set)) {
  32. _Object$defineProperty(newObj, key, desc);
  33. } else {
  34. newObj[key] = obj[key];
  35. }
  36. }
  37. }
  38. newObj["default"] = obj;
  39. if (cache) {
  40. cache.set(obj, newObj);
  41. }
  42. return newObj;
  43. }
  44. module.exports = _interopRequireWildcard;
  45. module.exports["default"] = module.exports, module.exports.__esModule = true;