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
optimacms-0.1.61 spec/dummy/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
disco_app-0.18.0 test/dummy/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
disco_app-0.18.2 test/dummy/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-5.0.7 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-5.0.6 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-5.0.5 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-5.0.4 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-5.0.3 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-5.0.2 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-5.0.1 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-4.3.5 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-5.0.0 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-4.3.4 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-4.3.3 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-4.3.2 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-4.3.1 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-4.3 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-4.2.3 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
tang-0.2.1 spec/tang_app/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-4.2.2 node_modules/@babel/runtime/helpers/wrapNativeSuper.js