1 | import _typeof from "@babel/runtime/helpers/typeof";
|
2 |
|
3 | function _getRequireWildcardCache(nodeInterop) {
|
4 | if (typeof WeakMap !== "function") return null;
|
5 | var cacheBabelInterop = new WeakMap();
|
6 | var cacheNodeInterop = new WeakMap();
|
7 | return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
|
8 | return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
9 | })(nodeInterop);
|
10 | }
|
11 |
|
12 | export default function _interopRequireWildcard(obj, nodeInterop) {
|
13 | if (!nodeInterop && obj && obj.__esModule) {
|
14 | return obj;
|
15 | }
|
16 |
|
17 | if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
|
18 | return {
|
19 | "default": obj
|
20 | };
|
21 | }
|
22 |
|
23 | var cache = _getRequireWildcardCache(nodeInterop);
|
24 |
|
25 | if (cache && cache.has(obj)) {
|
26 | return cache.get(obj);
|
27 | }
|
28 |
|
29 | var newObj = {};
|
30 | var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
31 |
|
32 | for (var key in obj) {
|
33 | if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
34 | var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
35 |
|
36 | if (desc && (desc.get || desc.set)) {
|
37 | Object.defineProperty(newObj, key, desc);
|
38 | } else {
|
39 | newObj[key] = obj[key];
|
40 | }
|
41 | }
|
42 | }
|
43 |
|
44 | newObj["default"] = obj;
|
45 |
|
46 | if (cache) {
|
47 | cache.set(obj, newObj);
|
48 | }
|
49 |
|
50 | return newObj;
|
51 | } |
\ | No newline at end of file |