source: trip-planner-front/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.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.1 KB
Line 
1import getPrototypeOf from "./getPrototypeOf.js";
2import setPrototypeOf from "./setPrototypeOf.js";
3import isNativeFunction from "./isNativeFunction.js";
4import construct from "./construct.js";
5export default function _wrapNativeSuper(Class) {
6 var _cache = typeof Map === "function" ? new Map() : undefined;
7
8 _wrapNativeSuper = function _wrapNativeSuper(Class) {
9 if (Class === null || !isNativeFunction(Class)) return Class;
10
11 if (typeof Class !== "function") {
12 throw new TypeError("Super expression must either be null or a function");
13 }
14
15 if (typeof _cache !== "undefined") {
16 if (_cache.has(Class)) return _cache.get(Class);
17
18 _cache.set(Class, Wrapper);
19 }
20
21 function Wrapper() {
22 return construct(Class, arguments, getPrototypeOf(this).constructor);
23 }
24
25 Wrapper.prototype = Object.create(Class.prototype, {
26 constructor: {
27 value: Wrapper,
28 enumerable: false,
29 writable: true,
30 configurable: true
31 }
32 });
33 return setPrototypeOf(Wrapper, Class);
34 };
35
36 return _wrapNativeSuper(Class);
37}
Note: See TracBrowser for help on using the repository browser.