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