You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
13 KiB

2 years ago
{"ast":null,"code":"'use strict';\n\nvar global = require('../internals/global');\n\nvar apply = require('../internals/function-apply');\n\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nvar isCallable = require('../internals/is-callable');\n\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\n\nvar isForced = require('../internals/is-forced');\n\nvar path = require('../internals/path');\n\nvar bind = require('../internals/function-bind-context');\n\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nvar hasOwn = require('../internals/has-own-property');\n\nvar wrapConstructor = function (NativeConstructor) {\n var Wrapper = function (a, b, c) {\n if (this instanceof Wrapper) {\n switch (arguments.length) {\n case 0:\n return new NativeConstructor();\n\n case 1:\n return new NativeConstructor(a);\n\n case 2:\n return new NativeConstructor(a, b);\n }\n\n return new NativeConstructor(a, b, c);\n }\n\n return apply(NativeConstructor, this, arguments);\n };\n\n Wrapper.prototype = NativeConstructor.prototype;\n return Wrapper;\n};\n/*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.dontCallGetSet - prevent calling a getter on target\n options.name - the .name of the function if it does not match the key\n*/\n\n\nmodule.exports = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var PROTO = options.proto;\n var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype;\n var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET];\n var targetPrototype = target.prototype;\n var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;\n var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;\n\n for (key in source) {\n FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contains in native\n\n USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key);\n targetProperty = target[key];\n if (USE_NATIVE) if (options.dontCallGetSet) {\n descriptor = getOwnPropertyDescriptor(nativeSource, key);\n nativeProperty = descriptor && descriptor.value;\n } else nativeProperty = nativeSource[key]; // export native or implementation\n\n sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key];\n if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue; // bind timers to global for call from export context\n\n if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global); // wrap global constructors for prevent changs in this version\n else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty); // make static versions for prototype methods\n else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis(sourceProperty); // default case\n else resultProperty = sourceProperty; // add a flag to not completely full polyfills\n\n if (options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) {\n createNonEnume