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
trusty-cms-4.2.1 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-4.2 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-4.1.9 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-4.1.8 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
tang-0.2.0 spec/tang_app/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-4.1.7 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
tang-0.1.0 spec/tang_app/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
tang-0.0.9 spec/tang_app/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-4.1.6 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
trusty-cms-4.1.5 node_modules/@babel/runtime/helpers/wrapNativeSuper.js
enju_library-0.3.8 spec/dummy/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
condenser-0.3 lib/condenser/processors/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
condenser-0.2 lib/condenser/processors/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
condenser-0.1 lib/condenser/processors/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
condenser-0.0.12 lib/condenser/processors/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
condenser-0.0.11 lib/condenser/processors/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
condenser-0.0.10 lib/condenser/processors/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
condenser-0.0.9 lib/condenser/processors/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
condenser-0.0.8 lib/condenser/processors/node_modules/@babel/runtime/helpers/wrapNativeSuper.js
jester-data-8.0.0 node_modules/@babel/runtime/helpers/wrapNativeSuper.js