Sha256: 5f87f83f346abc774e7c158e1168c187e198a524beda7386d42047bc68f54941

Contents?: true

Size: 1.05 KB

Versions: 48

Compression:

Stored size: 1.05 KB

Contents

import getPrototypeOf from "./getPrototypeOf";
import setPrototypeOf from "./setPrototypeOf";
import isNativeFunction from "./isNativeFunction";
import construct from "./construct";
export default function _wrapNativeSuper(Class) {
  var _cache = typeof Map === "function" ? new Map() : undefined;

  _wrapNativeSuper = function _wrapNativeSuper(Class) {
    if (Class === null || !isNativeFunction(Class)) return Class;

    if (typeof Class !== "function") {
      throw new TypeError("Super expression must either be null or a function");
    }

    if (typeof _cache !== "undefined") {
      if (_cache.has(Class)) return _cache.get(Class);

      _cache.set(Class, Wrapper);
    }

    function Wrapper() {
      return construct(Class, arguments, getPrototypeOf(this).constructor);
    }

    Wrapper.prototype = Object.create(Class.prototype, {
      constructor: {
        value: Wrapper,
        enumerable: false,
        writable: true,
        configurable: true
      }
    });
    return setPrototypeOf(Wrapper, Class);
  };

  return _wrapNativeSuper(Class);
}

Version data entries

48 entries across 48 versions & 8 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
disco_app-0.18.0 test/dummy/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
disco_app-0.18.2 test/dummy/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-5.0.7 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-5.0.6 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-5.0.5 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-5.0.4 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-5.0.3 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-5.0.2 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-5.0.1 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-4.3.5 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-5.0.0 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-4.3.4 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-4.3.3 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-4.3.2 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-4.3.1 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-4.3 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-4.2.3 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
tang-0.2.1 spec/tang_app/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
trusty-cms-4.2.2 node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js