main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
984 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import getPrototypeOf from "./getPrototypeOf.js";
|
---|
| 2 | import setPrototypeOf from "./setPrototypeOf.js";
|
---|
| 3 | import isNativeFunction from "./isNativeFunction.js";
|
---|
| 4 | import construct from "./construct.js";
|
---|
| 5 | function _wrapNativeSuper(t) {
|
---|
| 6 | var r = "function" == typeof Map ? new Map() : void 0;
|
---|
| 7 | return _wrapNativeSuper = function _wrapNativeSuper(t) {
|
---|
| 8 | if (null === t || !isNativeFunction(t)) return t;
|
---|
| 9 | if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
---|
| 10 | if (void 0 !== r) {
|
---|
| 11 | if (r.has(t)) return r.get(t);
|
---|
| 12 | r.set(t, Wrapper);
|
---|
| 13 | }
|
---|
| 14 | function Wrapper() {
|
---|
| 15 | return construct(t, arguments, getPrototypeOf(this).constructor);
|
---|
| 16 | }
|
---|
| 17 | return Wrapper.prototype = Object.create(t.prototype, {
|
---|
| 18 | constructor: {
|
---|
| 19 | value: Wrapper,
|
---|
| 20 | enumerable: !1,
|
---|
| 21 | writable: !0,
|
---|
| 22 | configurable: !0
|
---|
| 23 | }
|
---|
| 24 | }), setPrototypeOf(Wrapper, t);
|
---|
| 25 | }, _wrapNativeSuper(t);
|
---|
| 26 | }
|
---|
| 27 | export { _wrapNativeSuper as default }; |
---|
Note:
See
TracBrowser
for help on using the repository browser.