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