Sha256: c28f9797f29bfd7b9978dc55cb7ff26e6aa73eee6647f8dba0a116c782384210

Contents?: true

Size: 1.1 KB

Versions: 48

Compression:

Stored size: 1.1 KB

Contents

var getPrototypeOf = require("./getPrototypeOf");

var setPrototypeOf = require("./setPrototypeOf");

var isNativeFunction = require("./isNativeFunction");

var construct = require("./construct");

function _wrapNativeSuper(Class) {
  var _cache = typeof Map === "function" ? new Map() : undefined;

  module.exports = _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);
}

module.exports = _wrapNativeSuper;

Version data entries

48 entries across 48 versions & 8 rubygems

Version Path
ezii-os-5.2.1 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
ezii-os-2.0.1 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
ezii-os-1.1.0 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
ezii-os-1.0.0 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
condenser-0.0.7 lib/condenser/processors/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
ezii-os-0.0.0.1.0 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
ezii-os-0.0.0.0.1 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
condenser-0.0.5 lib/condenser/processors/node_modules/@babel/runtime/helpers/wrapNativeSuper.js