source: trip-planner-front/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1import _typeof from "@babel/runtime/helpers/typeof";
2
3function _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
12export 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}
Note: See TracBrowser for help on using the repository browser.