Grabbed dndbeyond's source code
``` ~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js ```
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
var isCallable = require('../internals/is-callable');
|
||||
var tryToString = require('../internals/try-to-string');
|
||||
|
||||
var $TypeError = TypeError;
|
||||
|
||||
// `Assert: IsCallable(argument) is true`
|
||||
module.exports = function (argument) {
|
||||
if (isCallable(argument)) return argument;
|
||||
throw new $TypeError(tryToString(argument) + ' is not a function');
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
var isPossiblePrototype = require('../internals/is-possible-prototype');
|
||||
|
||||
var $String = String;
|
||||
var $TypeError = TypeError;
|
||||
|
||||
module.exports = function (argument) {
|
||||
if (isPossiblePrototype(argument)) return argument;
|
||||
throw new $TypeError("Can't set " + $String(argument) + ' as a prototype');
|
||||
};
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
var wellKnownSymbol = require('../internals/well-known-symbol');
|
||||
var create = require('../internals/object-create');
|
||||
var defineProperty = require('../internals/object-define-property').f;
|
||||
|
||||
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
||||
var ArrayPrototype = Array.prototype;
|
||||
|
||||
// Array.prototype[@@unscopables]
|
||||
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
||||
if (ArrayPrototype[UNSCOPABLES] === undefined) {
|
||||
defineProperty(ArrayPrototype, UNSCOPABLES, {
|
||||
configurable: true,
|
||||
value: create(null)
|
||||
});
|
||||
}
|
||||
|
||||
// add a key to Array.prototype[@@unscopables]
|
||||
module.exports = function (key) {
|
||||
ArrayPrototype[UNSCOPABLES][key] = true;
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
var isPrototypeOf = require('../internals/object-is-prototype-of');
|
||||
|
||||
var $TypeError = TypeError;
|
||||
|
||||
module.exports = function (it, Prototype) {
|
||||
if (isPrototypeOf(Prototype, it)) return it;
|
||||
throw new $TypeError('Incorrect invocation');
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
var isObject = require('../internals/is-object');
|
||||
|
||||
var $String = String;
|
||||
var $TypeError = TypeError;
|
||||
|
||||
// `Assert: Type(argument) is Object`
|
||||
module.exports = function (argument) {
|
||||
if (isObject(argument)) return argument;
|
||||
throw new $TypeError($String(argument) + ' is not an object');
|
||||
};
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
var bind = require('../internals/function-bind-context');
|
||||
var call = require('../internals/function-call');
|
||||
var toObject = require('../internals/to-object');
|
||||
var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');
|
||||
var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
|
||||
var isConstructor = require('../internals/is-constructor');
|
||||
var lengthOfArrayLike = require('../internals/length-of-array-like');
|
||||
var createProperty = require('../internals/create-property');
|
||||
var getIterator = require('../internals/get-iterator');
|
||||
var getIteratorMethod = require('../internals/get-iterator-method');
|
||||
|
||||
var $Array = Array;
|
||||
|
||||
// `Array.from` method implementation
|
||||
// https://tc39.es/ecma262/#sec-array.from
|
||||
module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
|
||||
var O = toObject(arrayLike);
|
||||
var IS_CONSTRUCTOR = isConstructor(this);
|
||||
var argumentsLength = arguments.length;
|
||||
var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
|
||||
var mapping = mapfn !== undefined;
|
||||
if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
|
||||
var iteratorMethod = getIteratorMethod(O);
|
||||
var index = 0;
|
||||
var length, result, step, iterator, next, value;
|
||||
// if the target is not iterable or it's an array with the default iterator - use a simple case
|
||||
if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {
|
||||
result = IS_CONSTRUCTOR ? new this() : [];
|
||||
iterator = getIterator(O, iteratorMethod);
|
||||
next = iterator.next;
|
||||
for (;!(step = call(next, iterator)).done; index++) {
|
||||
value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
|
||||
createProperty(result, index, value);
|
||||
}
|
||||
} else {
|
||||
length = lengthOfArrayLike(O);
|
||||
result = IS_CONSTRUCTOR ? new this(length) : $Array(length);
|
||||
for (;length > index; index++) {
|
||||
value = mapping ? mapfn(O[index], index) : O[index];
|
||||
createProperty(result, index, value);
|
||||
}
|
||||
}
|
||||
result.length = index;
|
||||
return result;
|
||||
};
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
var toIndexedObject = require('../internals/to-indexed-object');
|
||||
var toAbsoluteIndex = require('../internals/to-absolute-index');
|
||||
var lengthOfArrayLike = require('../internals/length-of-array-like');
|
||||
|
||||
// `Array.prototype.{ indexOf, includes }` methods implementation
|
||||
var createMethod = function (IS_INCLUDES) {
|
||||
return function ($this, el, fromIndex) {
|
||||
var O = toIndexedObject($this);
|
||||
var length = lengthOfArrayLike(O);
|
||||
if (length === 0) return !IS_INCLUDES && -1;
|
||||
var index = toAbsoluteIndex(fromIndex, length);
|
||||
var value;
|
||||
// Array#includes uses SameValueZero equality algorithm
|
||||
// eslint-disable-next-line no-self-compare -- NaN check
|
||||
if (IS_INCLUDES && el !== el) while (length > index) {
|
||||
value = O[index++];
|
||||
// eslint-disable-next-line no-self-compare -- NaN check
|
||||
if (value !== value) return true;
|
||||
// Array#indexOf ignores holes, Array#includes - not
|
||||
} else for (;length > index; index++) {
|
||||
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
||||
} return !IS_INCLUDES && -1;
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
// `Array.prototype.includes` method
|
||||
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
||||
includes: createMethod(true),
|
||||
// `Array.prototype.indexOf` method
|
||||
// https://tc39.es/ecma262/#sec-array.prototype.indexof
|
||||
indexOf: createMethod(false)
|
||||
};
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
|
||||
module.exports = uncurryThis([].slice);
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
var arraySlice = require('../internals/array-slice');
|
||||
|
||||
var floor = Math.floor;
|
||||
|
||||
var sort = function (array, comparefn) {
|
||||
var length = array.length;
|
||||
|
||||
if (length < 8) {
|
||||
// insertion sort
|
||||
var i = 1;
|
||||
var element, j;
|
||||
|
||||
while (i < length) {
|
||||
j = i;
|
||||
element = array[i];
|
||||
while (j && comparefn(array[j - 1], element) > 0) {
|
||||
array[j] = array[--j];
|
||||
}
|
||||
if (j !== i++) array[j] = element;
|
||||
}
|
||||
} else {
|
||||
// merge sort
|
||||
var middle = floor(length / 2);
|
||||
var left = sort(arraySlice(array, 0, middle), comparefn);
|
||||
var right = sort(arraySlice(array, middle), comparefn);
|
||||
var llength = left.length;
|
||||
var rlength = right.length;
|
||||
var lindex = 0;
|
||||
var rindex = 0;
|
||||
|
||||
while (lindex < llength || rindex < rlength) {
|
||||
array[lindex + rindex] = (lindex < llength && rindex < rlength)
|
||||
? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
|
||||
: lindex < llength ? left[lindex++] : right[rindex++];
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
};
|
||||
|
||||
module.exports = sort;
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
var anObject = require('../internals/an-object');
|
||||
var iteratorClose = require('../internals/iterator-close');
|
||||
|
||||
// call something on iterator step with safe closing on error
|
||||
module.exports = function (iterator, fn, value, ENTRIES) {
|
||||
try {
|
||||
return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
|
||||
} catch (error) {
|
||||
iteratorClose(iterator, 'throw', error);
|
||||
}
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
|
||||
var toString = uncurryThis({}.toString);
|
||||
var stringSlice = uncurryThis(''.slice);
|
||||
|
||||
module.exports = function (it) {
|
||||
return stringSlice(toString(it), 8, -1);
|
||||
};
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
|
||||
var isCallable = require('../internals/is-callable');
|
||||
var classofRaw = require('../internals/classof-raw');
|
||||
var wellKnownSymbol = require('../internals/well-known-symbol');
|
||||
|
||||
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
||||
var $Object = Object;
|
||||
|
||||
// ES3 wrong here
|
||||
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
|
||||
|
||||
// fallback for IE11 Script Access Denied error
|
||||
var tryGet = function (it, key) {
|
||||
try {
|
||||
return it[key];
|
||||
} catch (error) { /* empty */ }
|
||||
};
|
||||
|
||||
// getting tag from ES6+ `Object.prototype.toString`
|
||||
module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
|
||||
var O, tag, result;
|
||||
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
||||
// @@toStringTag case
|
||||
: typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
|
||||
// builtinTag case
|
||||
: CORRECT_ARGUMENTS ? classofRaw(O)
|
||||
// ES3 arguments fallback
|
||||
: (result = classofRaw(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result;
|
||||
};
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
var hasOwn = require('../internals/has-own-property');
|
||||
var ownKeys = require('../internals/own-keys');
|
||||
var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
|
||||
var definePropertyModule = require('../internals/object-define-property');
|
||||
|
||||
module.exports = function (target, source, exceptions) {
|
||||
var keys = ownKeys(source);
|
||||
var defineProperty = definePropertyModule.f;
|
||||
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
|
||||
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
||||
}
|
||||
}
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
var fails = require('../internals/fails');
|
||||
|
||||
module.exports = !fails(function () {
|
||||
function F() { /* empty */ }
|
||||
F.prototype.constructor = null;
|
||||
// eslint-disable-next-line es/no-object-getprototypeof -- required for testing
|
||||
return Object.getPrototypeOf(new F()) !== F.prototype;
|
||||
});
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
// `CreateIterResultObject` abstract operation
|
||||
// https://tc39.es/ecma262/#sec-createiterresultobject
|
||||
module.exports = function (value, done) {
|
||||
return { value: value, done: done };
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
var DESCRIPTORS = require('../internals/descriptors');
|
||||
var definePropertyModule = require('../internals/object-define-property');
|
||||
var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
||||
|
||||
module.exports = DESCRIPTORS ? function (object, key, value) {
|
||||
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
||||
} : function (object, key, value) {
|
||||
object[key] = value;
|
||||
return object;
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
module.exports = function (bitmap, value) {
|
||||
return {
|
||||
enumerable: !(bitmap & 1),
|
||||
configurable: !(bitmap & 2),
|
||||
writable: !(bitmap & 4),
|
||||
value: value
|
||||
};
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
var DESCRIPTORS = require('../internals/descriptors');
|
||||
var definePropertyModule = require('../internals/object-define-property');
|
||||
var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
||||
|
||||
module.exports = function (object, key, value) {
|
||||
if (DESCRIPTORS) definePropertyModule.f(object, key, createPropertyDescriptor(0, value));
|
||||
else object[key] = value;
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
var makeBuiltIn = require('../internals/make-built-in');
|
||||
var defineProperty = require('../internals/object-define-property');
|
||||
|
||||
module.exports = function (target, name, descriptor) {
|
||||
if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
|
||||
if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
|
||||
return defineProperty.f(target, name, descriptor);
|
||||
};
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
var isCallable = require('../internals/is-callable');
|
||||
var definePropertyModule = require('../internals/object-define-property');
|
||||
var makeBuiltIn = require('../internals/make-built-in');
|
||||
var defineGlobalProperty = require('../internals/define-global-property');
|
||||
|
||||
module.exports = function (O, key, value, options) {
|
||||
if (!options) options = {};
|
||||
var simple = options.enumerable;
|
||||
var name = options.name !== undefined ? options.name : key;
|
||||
if (isCallable(value)) makeBuiltIn(value, name, options);
|
||||
if (options.global) {
|
||||
if (simple) O[key] = value;
|
||||
else defineGlobalProperty(key, value);
|
||||
} else {
|
||||
try {
|
||||
if (!options.unsafe) delete O[key];
|
||||
else if (O[key]) simple = true;
|
||||
} catch (error) { /* empty */ }
|
||||
if (simple) O[key] = value;
|
||||
else definePropertyModule.f(O, key, {
|
||||
value: value,
|
||||
enumerable: false,
|
||||
configurable: !options.nonConfigurable,
|
||||
writable: !options.nonWritable
|
||||
});
|
||||
} return O;
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
var defineBuiltIn = require('../internals/define-built-in');
|
||||
|
||||
module.exports = function (target, src, options) {
|
||||
for (var key in src) defineBuiltIn(target, key, src[key], options);
|
||||
return target;
|
||||
};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
var global = require('../internals/global');
|
||||
|
||||
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
||||
var defineProperty = Object.defineProperty;
|
||||
|
||||
module.exports = function (key, value) {
|
||||
try {
|
||||
defineProperty(global, key, { value: value, configurable: true, writable: true });
|
||||
} catch (error) {
|
||||
global[key] = value;
|
||||
} return value;
|
||||
};
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
var fails = require('../internals/fails');
|
||||
|
||||
// Detect IE8's incomplete defineProperty implementation
|
||||
module.exports = !fails(function () {
|
||||
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
||||
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
|
||||
});
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
var global = require('../internals/global');
|
||||
var isObject = require('../internals/is-object');
|
||||
|
||||
var document = global.document;
|
||||
// typeof document.createElement is 'object' in old IE
|
||||
var EXISTS = isObject(document) && isObject(document.createElement);
|
||||
|
||||
module.exports = function (it) {
|
||||
return EXISTS ? document.createElement(it) : {};
|
||||
};
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
// iterable DOM collections
|
||||
// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
|
||||
module.exports = {
|
||||
CSSRuleList: 0,
|
||||
CSSStyleDeclaration: 0,
|
||||
CSSValueList: 0,
|
||||
ClientRectList: 0,
|
||||
DOMRectList: 0,
|
||||
DOMStringList: 0,
|
||||
DOMTokenList: 1,
|
||||
DataTransferItemList: 0,
|
||||
FileList: 0,
|
||||
HTMLAllCollection: 0,
|
||||
HTMLCollection: 0,
|
||||
HTMLFormElement: 0,
|
||||
HTMLSelectElement: 0,
|
||||
MediaList: 0,
|
||||
MimeTypeArray: 0,
|
||||
NamedNodeMap: 0,
|
||||
NodeList: 1,
|
||||
PaintRequestList: 0,
|
||||
Plugin: 0,
|
||||
PluginArray: 0,
|
||||
SVGLengthList: 0,
|
||||
SVGNumberList: 0,
|
||||
SVGPathSegList: 0,
|
||||
SVGPointList: 0,
|
||||
SVGStringList: 0,
|
||||
SVGTransformList: 0,
|
||||
SourceBufferList: 0,
|
||||
StyleSheetList: 0,
|
||||
TextTrackCueList: 0,
|
||||
TextTrackList: 0,
|
||||
TouchList: 0
|
||||
};
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
// in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
|
||||
var documentCreateElement = require('../internals/document-create-element');
|
||||
|
||||
var classList = documentCreateElement('span').classList;
|
||||
var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype;
|
||||
|
||||
module.exports = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
var global = require('../internals/global');
|
||||
var userAgent = require('../internals/engine-user-agent');
|
||||
|
||||
var process = global.process;
|
||||
var Deno = global.Deno;
|
||||
var versions = process && process.versions || Deno && Deno.version;
|
||||
var v8 = versions && versions.v8;
|
||||
var match, version;
|
||||
|
||||
if (v8) {
|
||||
match = v8.split('.');
|
||||
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
||||
// but their correct versions are not interesting for us
|
||||
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
||||
}
|
||||
|
||||
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
||||
// so check `userAgent` even if `.v8` exists, but 0
|
||||
if (!version && userAgent) {
|
||||
match = userAgent.match(/Edge\/(\d+)/);
|
||||
if (!match || match[1] >= 74) {
|
||||
match = userAgent.match(/Chrome\/(\d+)/);
|
||||
if (match) version = +match[1];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = version;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
// IE8- don't enum bug keys
|
||||
module.exports = [
|
||||
'constructor',
|
||||
'hasOwnProperty',
|
||||
'isPrototypeOf',
|
||||
'propertyIsEnumerable',
|
||||
'toLocaleString',
|
||||
'toString',
|
||||
'valueOf'
|
||||
];
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
'use strict';
|
||||
var global = require('../internals/global');
|
||||
var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
|
||||
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
||||
var defineBuiltIn = require('../internals/define-built-in');
|
||||
var defineGlobalProperty = require('../internals/define-global-property');
|
||||
var copyConstructorProperties = require('../internals/copy-constructor-properties');
|
||||
var isForced = require('../internals/is-forced');
|
||||
|
||||
/*
|
||||
options.target - name of the target object
|
||||
options.global - target is the global object
|
||||
options.stat - export as static methods of target
|
||||
options.proto - export as prototype methods of target
|
||||
options.real - real prototype method for the `pure` version
|
||||
options.forced - export even if the native feature is available
|
||||
options.bind - bind methods to the target, required for the `pure` version
|
||||
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
||||
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
||||
options.sham - add a flag to not completely full polyfills
|
||||
options.enumerable - export as enumerable property
|
||||
options.dontCallGetSet - prevent calling a getter on target
|
||||
options.name - the .name of the function if it does not match the key
|
||||
*/
|
||||
module.exports = function (options, source) {
|
||||
var TARGET = options.target;
|
||||
var GLOBAL = options.global;
|
||||
var STATIC = options.stat;
|
||||
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
||||
if (GLOBAL) {
|
||||
target = global;
|
||||
} else if (STATIC) {
|
||||
target = global[TARGET] || defineGlobalProperty(TARGET, {});
|
||||
} else {
|
||||
target = global[TARGET] && global[TARGET].prototype;
|
||||
}
|
||||
if (target) for (key in source) {
|
||||
sourceProperty = source[key];
|
||||
if (options.dontCallGetSet) {
|
||||
descriptor = getOwnPropertyDescriptor(target, key);
|
||||
targetProperty = descriptor && descriptor.value;
|
||||
} else targetProperty = target[key];
|
||||
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
||||
// contained in target
|
||||
if (!FORCED && targetProperty !== undefined) {
|
||||
if (typeof sourceProperty == typeof targetProperty) continue;
|
||||
copyConstructorProperties(sourceProperty, targetProperty);
|
||||
}
|
||||
// add a flag to not completely full polyfills
|
||||
if (options.sham || (targetProperty && targetProperty.sham)) {
|
||||
createNonEnumerableProperty(sourceProperty, 'sham', true);
|
||||
}
|
||||
defineBuiltIn(target, key, sourceProperty, options);
|
||||
}
|
||||
};
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
module.exports = function (exec) {
|
||||
try {
|
||||
return !!exec();
|
||||
} catch (error) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
var uncurryThis = require('../internals/function-uncurry-this-clause');
|
||||
var aCallable = require('../internals/a-callable');
|
||||
var NATIVE_BIND = require('../internals/function-bind-native');
|
||||
|
||||
var bind = uncurryThis(uncurryThis.bind);
|
||||
|
||||
// optional / simple context binding
|
||||
module.exports = function (fn, that) {
|
||||
aCallable(fn);
|
||||
return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {
|
||||
return fn.apply(that, arguments);
|
||||
};
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
var fails = require('../internals/fails');
|
||||
|
||||
module.exports = !fails(function () {
|
||||
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
||||
var test = (function () { /* empty */ }).bind();
|
||||
// eslint-disable-next-line no-prototype-builtins -- safe
|
||||
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
||||
});
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
var NATIVE_BIND = require('../internals/function-bind-native');
|
||||
|
||||
var call = Function.prototype.call;
|
||||
|
||||
module.exports = NATIVE_BIND ? call.bind(call) : function () {
|
||||
return call.apply(call, arguments);
|
||||
};
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
var DESCRIPTORS = require('../internals/descriptors');
|
||||
var hasOwn = require('../internals/has-own-property');
|
||||
|
||||
var FunctionPrototype = Function.prototype;
|
||||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||||
var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
|
||||
|
||||
var EXISTS = hasOwn(FunctionPrototype, 'name');
|
||||
// additional protection from minified / mangled / dropped function names
|
||||
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
|
||||
var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
|
||||
|
||||
module.exports = {
|
||||
EXISTS: EXISTS,
|
||||
PROPER: PROPER,
|
||||
CONFIGURABLE: CONFIGURABLE
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
var aCallable = require('../internals/a-callable');
|
||||
|
||||
module.exports = function (object, key, method) {
|
||||
try {
|
||||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||||
return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method]));
|
||||
} catch (error) { /* empty */ }
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
var classofRaw = require('../internals/classof-raw');
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
|
||||
module.exports = function (fn) {
|
||||
// Nashorn bug:
|
||||
// https://github.com/zloirock/core-js/issues/1128
|
||||
// https://github.com/zloirock/core-js/issues/1130
|
||||
if (classofRaw(fn) === 'Function') return uncurryThis(fn);
|
||||
};
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
var NATIVE_BIND = require('../internals/function-bind-native');
|
||||
|
||||
var FunctionPrototype = Function.prototype;
|
||||
var call = FunctionPrototype.call;
|
||||
var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
|
||||
|
||||
module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
|
||||
return function () {
|
||||
return call.apply(fn, arguments);
|
||||
};
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
var global = require('../internals/global');
|
||||
var isCallable = require('../internals/is-callable');
|
||||
|
||||
var aFunction = function (argument) {
|
||||
return isCallable(argument) ? argument : undefined;
|
||||
};
|
||||
|
||||
module.exports = function (namespace, method) {
|
||||
return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
|
||||
};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
var classof = require('../internals/classof');
|
||||
var getMethod = require('../internals/get-method');
|
||||
var isNullOrUndefined = require('../internals/is-null-or-undefined');
|
||||
var Iterators = require('../internals/iterators');
|
||||
var wellKnownSymbol = require('../internals/well-known-symbol');
|
||||
|
||||
var ITERATOR = wellKnownSymbol('iterator');
|
||||
|
||||
module.exports = function (it) {
|
||||
if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR)
|
||||
|| getMethod(it, '@@iterator')
|
||||
|| Iterators[classof(it)];
|
||||
};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
var call = require('../internals/function-call');
|
||||
var aCallable = require('../internals/a-callable');
|
||||
var anObject = require('../internals/an-object');
|
||||
var tryToString = require('../internals/try-to-string');
|
||||
var getIteratorMethod = require('../internals/get-iterator-method');
|
||||
|
||||
var $TypeError = TypeError;
|
||||
|
||||
module.exports = function (argument, usingIterator) {
|
||||
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
|
||||
if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
|
||||
throw new $TypeError(tryToString(argument) + ' is not iterable');
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
var aCallable = require('../internals/a-callable');
|
||||
var isNullOrUndefined = require('../internals/is-null-or-undefined');
|
||||
|
||||
// `GetMethod` abstract operation
|
||||
// https://tc39.es/ecma262/#sec-getmethod
|
||||
module.exports = function (V, P) {
|
||||
var func = V[P];
|
||||
return isNullOrUndefined(func) ? undefined : aCallable(func);
|
||||
};
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
var check = function (it) {
|
||||
return it && it.Math === Math && it;
|
||||
};
|
||||
|
||||
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
||||
module.exports =
|
||||
// eslint-disable-next-line es/no-global-this -- safe
|
||||
check(typeof globalThis == 'object' && globalThis) ||
|
||||
check(typeof window == 'object' && window) ||
|
||||
// eslint-disable-next-line no-restricted-globals -- safe
|
||||
check(typeof self == 'object' && self) ||
|
||||
check(typeof global == 'object' && global) ||
|
||||
check(typeof this == 'object' && this) ||
|
||||
// eslint-disable-next-line no-new-func -- fallback
|
||||
(function () { return this; })() || Function('return this')();
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
var toObject = require('../internals/to-object');
|
||||
|
||||
var hasOwnProperty = uncurryThis({}.hasOwnProperty);
|
||||
|
||||
// `HasOwnProperty` abstract operation
|
||||
// https://tc39.es/ecma262/#sec-hasownproperty
|
||||
// eslint-disable-next-line es/no-object-hasown -- safe
|
||||
module.exports = Object.hasOwn || function hasOwn(it, key) {
|
||||
return hasOwnProperty(toObject(it), key);
|
||||
};
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = {};
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
var getBuiltIn = require('../internals/get-built-in');
|
||||
|
||||
module.exports = getBuiltIn('document', 'documentElement');
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
var DESCRIPTORS = require('../internals/descriptors');
|
||||
var fails = require('../internals/fails');
|
||||
var createElement = require('../internals/document-create-element');
|
||||
|
||||
// Thanks to IE8 for its funny defineProperty
|
||||
module.exports = !DESCRIPTORS && !fails(function () {
|
||||
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
||||
return Object.defineProperty(createElement('div'), 'a', {
|
||||
get: function () { return 7; }
|
||||
}).a !== 7;
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
var fails = require('../internals/fails');
|
||||
var classof = require('../internals/classof-raw');
|
||||
|
||||
var $Object = Object;
|
||||
var split = uncurryThis(''.split);
|
||||
|
||||
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
||||
module.exports = fails(function () {
|
||||
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
||||
// eslint-disable-next-line no-prototype-builtins -- safe
|
||||
return !$Object('z').propertyIsEnumerable(0);
|
||||
}) ? function (it) {
|
||||
return classof(it) === 'String' ? split(it, '') : $Object(it);
|
||||
} : $Object;
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
var isCallable = require('../internals/is-callable');
|
||||
var store = require('../internals/shared-store');
|
||||
|
||||
var functionToString = uncurryThis(Function.toString);
|
||||
|
||||
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
||||
if (!isCallable(store.inspectSource)) {
|
||||
store.inspectSource = function (it) {
|
||||
return functionToString(it);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = store.inspectSource;
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
'use strict';
|
||||
var NATIVE_WEAK_MAP = require('../internals/weak-map-basic-detection');
|
||||
var global = require('../internals/global');
|
||||
var isObject = require('../internals/is-object');
|
||||
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
||||
var hasOwn = require('../internals/has-own-property');
|
||||
var shared = require('../internals/shared-store');
|
||||
var sharedKey = require('../internals/shared-key');
|
||||
var hiddenKeys = require('../internals/hidden-keys');
|
||||
|
||||
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
||||
var TypeError = global.TypeError;
|
||||
var WeakMap = global.WeakMap;
|
||||
var set, get, has;
|
||||
|
||||
var enforce = function (it) {
|
||||
return has(it) ? get(it) : set(it, {});
|
||||
};
|
||||
|
||||
var getterFor = function (TYPE) {
|
||||
return function (it) {
|
||||
var state;
|
||||
if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
||||
throw new TypeError('Incompatible receiver, ' + TYPE + ' required');
|
||||
} return state;
|
||||
};
|
||||
};
|
||||
|
||||
if (NATIVE_WEAK_MAP || shared.state) {
|
||||
var store = shared.state || (shared.state = new WeakMap());
|
||||
/* eslint-disable no-self-assign -- prototype methods protection */
|
||||
store.get = store.get;
|
||||
store.has = store.has;
|
||||
store.set = store.set;
|
||||
/* eslint-enable no-self-assign -- prototype methods protection */
|
||||
set = function (it, metadata) {
|
||||
if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
|
||||
metadata.facade = it;
|
||||
store.set(it, metadata);
|
||||
return metadata;
|
||||
};
|
||||
get = function (it) {
|
||||
return store.get(it) || {};
|
||||
};
|
||||
has = function (it) {
|
||||
return store.has(it);
|
||||
};
|
||||
} else {
|
||||
var STATE = sharedKey('state');
|
||||
hiddenKeys[STATE] = true;
|
||||
set = function (it, metadata) {
|
||||
if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
|
||||
metadata.facade = it;
|
||||
createNonEnumerableProperty(it, STATE, metadata);
|
||||
return metadata;
|
||||
};
|
||||
get = function (it) {
|
||||
return hasOwn(it, STATE) ? it[STATE] : {};
|
||||
};
|
||||
has = function (it) {
|
||||
return hasOwn(it, STATE);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
set: set,
|
||||
get: get,
|
||||
has: has,
|
||||
enforce: enforce,
|
||||
getterFor: getterFor
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
var wellKnownSymbol = require('../internals/well-known-symbol');
|
||||
var Iterators = require('../internals/iterators');
|
||||
|
||||
var ITERATOR = wellKnownSymbol('iterator');
|
||||
var ArrayPrototype = Array.prototype;
|
||||
|
||||
// check on default Array iterator
|
||||
module.exports = function (it) {
|
||||
return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
|
||||
};
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
||||
var documentAll = typeof document == 'object' && document.all;
|
||||
|
||||
// `IsCallable` abstract operation
|
||||
// https://tc39.es/ecma262/#sec-iscallable
|
||||
// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
|
||||
module.exports = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
|
||||
return typeof argument == 'function' || argument === documentAll;
|
||||
} : function (argument) {
|
||||
return typeof argument == 'function';
|
||||
};
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
var fails = require('../internals/fails');
|
||||
var isCallable = require('../internals/is-callable');
|
||||
var classof = require('../internals/classof');
|
||||
var getBuiltIn = require('../internals/get-built-in');
|
||||
var inspectSource = require('../internals/inspect-source');
|
||||
|
||||
var noop = function () { /* empty */ };
|
||||
var construct = getBuiltIn('Reflect', 'construct');
|
||||
var constructorRegExp = /^\s*(?:class|function)\b/;
|
||||
var exec = uncurryThis(constructorRegExp.exec);
|
||||
var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
|
||||
|
||||
var isConstructorModern = function isConstructor(argument) {
|
||||
if (!isCallable(argument)) return false;
|
||||
try {
|
||||
construct(noop, [], argument);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
var isConstructorLegacy = function isConstructor(argument) {
|
||||
if (!isCallable(argument)) return false;
|
||||
switch (classof(argument)) {
|
||||
case 'AsyncFunction':
|
||||
case 'GeneratorFunction':
|
||||
case 'AsyncGeneratorFunction': return false;
|
||||
}
|
||||
try {
|
||||
// we can't check .prototype since constructors produced by .bind haven't it
|
||||
// `Function#toString` throws on some built-it function in some legacy engines
|
||||
// (for example, `DOMQuad` and similar in FF41-)
|
||||
return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
|
||||
} catch (error) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
isConstructorLegacy.sham = true;
|
||||
|
||||
// `IsConstructor` abstract operation
|
||||
// https://tc39.es/ecma262/#sec-isconstructor
|
||||
module.exports = !construct || fails(function () {
|
||||
var called;
|
||||
return isConstructorModern(isConstructorModern.call)
|
||||
|| !isConstructorModern(Object)
|
||||
|| !isConstructorModern(function () { called = true; })
|
||||
|| called;
|
||||
}) ? isConstructorLegacy : isConstructorModern;
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
var fails = require('../internals/fails');
|
||||
var isCallable = require('../internals/is-callable');
|
||||
|
||||
var replacement = /#|\.prototype\./;
|
||||
|
||||
var isForced = function (feature, detection) {
|
||||
var value = data[normalize(feature)];
|
||||
return value === POLYFILL ? true
|
||||
: value === NATIVE ? false
|
||||
: isCallable(detection) ? fails(detection)
|
||||
: !!detection;
|
||||
};
|
||||
|
||||
var normalize = isForced.normalize = function (string) {
|
||||
return String(string).replace(replacement, '.').toLowerCase();
|
||||
};
|
||||
|
||||
var data = isForced.data = {};
|
||||
var NATIVE = isForced.NATIVE = 'N';
|
||||
var POLYFILL = isForced.POLYFILL = 'P';
|
||||
|
||||
module.exports = isForced;
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
// we can't use just `it == null` since of `document.all` special case
|
||||
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
|
||||
module.exports = function (it) {
|
||||
return it === null || it === undefined;
|
||||
};
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
var isCallable = require('../internals/is-callable');
|
||||
|
||||
module.exports = function (it) {
|
||||
return typeof it == 'object' ? it !== null : isCallable(it);
|
||||
};
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
var isObject = require('../internals/is-object');
|
||||
|
||||
module.exports = function (argument) {
|
||||
return isObject(argument) || argument === null;
|
||||
};
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = false;
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
var getBuiltIn = require('../internals/get-built-in');
|
||||
var isCallable = require('../internals/is-callable');
|
||||
var isPrototypeOf = require('../internals/object-is-prototype-of');
|
||||
var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
|
||||
|
||||
var $Object = Object;
|
||||
|
||||
module.exports = USE_SYMBOL_AS_UID ? function (it) {
|
||||
return typeof it == 'symbol';
|
||||
} : function (it) {
|
||||
var $Symbol = getBuiltIn('Symbol');
|
||||
return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
|
||||
};
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
var call = require('../internals/function-call');
|
||||
var anObject = require('../internals/an-object');
|
||||
var getMethod = require('../internals/get-method');
|
||||
|
||||
module.exports = function (iterator, kind, value) {
|
||||
var innerResult, innerError;
|
||||
anObject(iterator);
|
||||
try {
|
||||
innerResult = getMethod(iterator, 'return');
|
||||
if (!innerResult) {
|
||||
if (kind === 'throw') throw value;
|
||||
return value;
|
||||
}
|
||||
innerResult = call(innerResult, iterator);
|
||||
} catch (error) {
|
||||
innerError = true;
|
||||
innerResult = error;
|
||||
}
|
||||
if (kind === 'throw') throw value;
|
||||
if (innerError) throw innerResult;
|
||||
anObject(innerResult);
|
||||
return value;
|
||||
};
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;
|
||||
var create = require('../internals/object-create');
|
||||
var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
||||
var setToStringTag = require('../internals/set-to-string-tag');
|
||||
var Iterators = require('../internals/iterators');
|
||||
|
||||
var returnThis = function () { return this; };
|
||||
|
||||
module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
|
||||
var TO_STRING_TAG = NAME + ' Iterator';
|
||||
IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
|
||||
setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
|
||||
Iterators[TO_STRING_TAG] = returnThis;
|
||||
return IteratorConstructor;
|
||||
};
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
'use strict';
|
||||
var $ = require('../internals/export');
|
||||
var call = require('../internals/function-call');
|
||||
var IS_PURE = require('../internals/is-pure');
|
||||
var FunctionName = require('../internals/function-name');
|
||||
var isCallable = require('../internals/is-callable');
|
||||
var createIteratorConstructor = require('../internals/iterator-create-constructor');
|
||||
var getPrototypeOf = require('../internals/object-get-prototype-of');
|
||||
var setPrototypeOf = require('../internals/object-set-prototype-of');
|
||||
var setToStringTag = require('../internals/set-to-string-tag');
|
||||
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
||||
var defineBuiltIn = require('../internals/define-built-in');
|
||||
var wellKnownSymbol = require('../internals/well-known-symbol');
|
||||
var Iterators = require('../internals/iterators');
|
||||
var IteratorsCore = require('../internals/iterators-core');
|
||||
|
||||
var PROPER_FUNCTION_NAME = FunctionName.PROPER;
|
||||
var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
|
||||
var IteratorPrototype = IteratorsCore.IteratorPrototype;
|
||||
var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
|
||||
var ITERATOR = wellKnownSymbol('iterator');
|
||||
var KEYS = 'keys';
|
||||
var VALUES = 'values';
|
||||
var ENTRIES = 'entries';
|
||||
|
||||
var returnThis = function () { return this; };
|
||||
|
||||
module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
|
||||
createIteratorConstructor(IteratorConstructor, NAME, next);
|
||||
|
||||
var getIterationMethod = function (KIND) {
|
||||
if (KIND === DEFAULT && defaultIterator) return defaultIterator;
|
||||
if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND];
|
||||
|
||||
switch (KIND) {
|
||||
case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
|
||||
case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
|
||||
case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
|
||||
}
|
||||
|
||||
return function () { return new IteratorConstructor(this); };
|
||||
};
|
||||
|
||||
var TO_STRING_TAG = NAME + ' Iterator';
|
||||
var INCORRECT_VALUES_NAME = false;
|
||||
var IterablePrototype = Iterable.prototype;
|
||||
var nativeIterator = IterablePrototype[ITERATOR]
|
||||
|| IterablePrototype['@@iterator']
|
||||
|| DEFAULT && IterablePrototype[DEFAULT];
|
||||
var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
|
||||
var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
|
||||
var CurrentIteratorPrototype, methods, KEY;
|
||||
|
||||
// fix native
|
||||
if (anyNativeIterator) {
|
||||
CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
|
||||
if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
|
||||
if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
|
||||
if (setPrototypeOf) {
|
||||
setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
|
||||
} else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
|
||||
defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
|
||||
}
|
||||
}
|
||||
// Set @@toStringTag to native iterators
|
||||
setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
|
||||
if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
|
||||
}
|
||||
}
|
||||
|
||||
// fix Array.prototype.{ values, @@iterator }.name in V8 / FF
|
||||
if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
||||
if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
|
||||
createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
|
||||
} else {
|
||||
INCORRECT_VALUES_NAME = true;
|
||||
defaultIterator = function values() { return call(nativeIterator, this); };
|
||||
}
|
||||
}
|
||||
|
||||
// export additional methods
|
||||
if (DEFAULT) {
|
||||
methods = {
|
||||
values: getIterationMethod(VALUES),
|
||||
keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
|
||||
entries: getIterationMethod(ENTRIES)
|
||||
};
|
||||
if (FORCED) for (KEY in methods) {
|
||||
if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
|
||||
defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
|
||||
}
|
||||
} else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
|
||||
}
|
||||
|
||||
// define iterator
|
||||
if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
|
||||
defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
|
||||
}
|
||||
Iterators[NAME] = defaultIterator;
|
||||
|
||||
return methods;
|
||||
};
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
'use strict';
|
||||
var fails = require('../internals/fails');
|
||||
var isCallable = require('../internals/is-callable');
|
||||
var isObject = require('../internals/is-object');
|
||||
var create = require('../internals/object-create');
|
||||
var getPrototypeOf = require('../internals/object-get-prototype-of');
|
||||
var defineBuiltIn = require('../internals/define-built-in');
|
||||
var wellKnownSymbol = require('../internals/well-known-symbol');
|
||||
var IS_PURE = require('../internals/is-pure');
|
||||
|
||||
var ITERATOR = wellKnownSymbol('iterator');
|
||||
var BUGGY_SAFARI_ITERATORS = false;
|
||||
|
||||
// `%IteratorPrototype%` object
|
||||
// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
|
||||
var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
|
||||
|
||||
/* eslint-disable es/no-array-prototype-keys -- safe */
|
||||
if ([].keys) {
|
||||
arrayIterator = [].keys();
|
||||
// Safari 8 has buggy iterators w/o `next`
|
||||
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
|
||||
else {
|
||||
PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
|
||||
if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
|
||||
}
|
||||
}
|
||||
|
||||
var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () {
|
||||
var test = {};
|
||||
// FF44- legacy iterators case
|
||||
return IteratorPrototype[ITERATOR].call(test) !== test;
|
||||
});
|
||||
|
||||
if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
|
||||
else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
|
||||
|
||||
// `%IteratorPrototype%[@@iterator]()` method
|
||||
// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
|
||||
if (!isCallable(IteratorPrototype[ITERATOR])) {
|
||||
defineBuiltIn(IteratorPrototype, ITERATOR, function () {
|
||||
return this;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
IteratorPrototype: IteratorPrototype,
|
||||
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
|
||||
};
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = {};
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
var toLength = require('../internals/to-length');
|
||||
|
||||
// `LengthOfArrayLike` abstract operation
|
||||
// https://tc39.es/ecma262/#sec-lengthofarraylike
|
||||
module.exports = function (obj) {
|
||||
return toLength(obj.length);
|
||||
};
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
'use strict';
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
var fails = require('../internals/fails');
|
||||
var isCallable = require('../internals/is-callable');
|
||||
var hasOwn = require('../internals/has-own-property');
|
||||
var DESCRIPTORS = require('../internals/descriptors');
|
||||
var CONFIGURABLE_FUNCTION_NAME = require('../internals/function-name').CONFIGURABLE;
|
||||
var inspectSource = require('../internals/inspect-source');
|
||||
var InternalStateModule = require('../internals/internal-state');
|
||||
|
||||
var enforceInternalState = InternalStateModule.enforce;
|
||||
var getInternalState = InternalStateModule.get;
|
||||
var $String = String;
|
||||
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
||||
var defineProperty = Object.defineProperty;
|
||||
var stringSlice = uncurryThis(''.slice);
|
||||
var replace = uncurryThis(''.replace);
|
||||
var join = uncurryThis([].join);
|
||||
|
||||
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
|
||||
return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
|
||||
});
|
||||
|
||||
var TEMPLATE = String(String).split('String');
|
||||
|
||||
var makeBuiltIn = module.exports = function (value, name, options) {
|
||||
if (stringSlice($String(name), 0, 7) === 'Symbol(') {
|
||||
name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
|
||||
}
|
||||
if (options && options.getter) name = 'get ' + name;
|
||||
if (options && options.setter) name = 'set ' + name;
|
||||
if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
|
||||
if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true });
|
||||
else value.name = name;
|
||||
}
|
||||
if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
|
||||
defineProperty(value, 'length', { value: options.arity });
|
||||
}
|
||||
try {
|
||||
if (options && hasOwn(options, 'constructor') && options.constructor) {
|
||||
if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });
|
||||
// in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
|
||||
} else if (value.prototype) value.prototype = undefined;
|
||||
} catch (error) { /* empty */ }
|
||||
var state = enforceInternalState(value);
|
||||
if (!hasOwn(state, 'source')) {
|
||||
state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
|
||||
} return value;
|
||||
};
|
||||
|
||||
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
||||
// eslint-disable-next-line no-extend-native -- required
|
||||
Function.prototype.toString = makeBuiltIn(function toString() {
|
||||
return isCallable(this) && getInternalState(this).source || inspectSource(this);
|
||||
}, 'toString');
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
var ceil = Math.ceil;
|
||||
var floor = Math.floor;
|
||||
|
||||
// `Math.trunc` method
|
||||
// https://tc39.es/ecma262/#sec-math.trunc
|
||||
// eslint-disable-next-line es/no-math-trunc -- safe
|
||||
module.exports = Math.trunc || function trunc(x) {
|
||||
var n = +x;
|
||||
return (n > 0 ? floor : ceil)(n);
|
||||
};
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
'use strict';
|
||||
var DESCRIPTORS = require('../internals/descriptors');
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
var call = require('../internals/function-call');
|
||||
var fails = require('../internals/fails');
|
||||
var objectKeys = require('../internals/object-keys');
|
||||
var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
|
||||
var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
|
||||
var toObject = require('../internals/to-object');
|
||||
var IndexedObject = require('../internals/indexed-object');
|
||||
|
||||
// eslint-disable-next-line es/no-object-assign -- safe
|
||||
var $assign = Object.assign;
|
||||
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
||||
var defineProperty = Object.defineProperty;
|
||||
var concat = uncurryThis([].concat);
|
||||
|
||||
// `Object.assign` method
|
||||
// https://tc39.es/ecma262/#sec-object.assign
|
||||
module.exports = !$assign || fails(function () {
|
||||
// should have correct order of operations (Edge bug)
|
||||
if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
defineProperty(this, 'b', {
|
||||
value: 3,
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
}), { b: 2 })).b !== 1) return true;
|
||||
// should work with symbols and should have deterministic property order (V8 bug)
|
||||
var A = {};
|
||||
var B = {};
|
||||
// eslint-disable-next-line es/no-symbol -- safe
|
||||
var symbol = Symbol('assign detection');
|
||||
var alphabet = 'abcdefghijklmnopqrst';
|
||||
A[symbol] = 7;
|
||||
alphabet.split('').forEach(function (chr) { B[chr] = chr; });
|
||||
return $assign({}, A)[symbol] !== 7 || objectKeys($assign({}, B)).join('') !== alphabet;
|
||||
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
|
||||
var T = toObject(target);
|
||||
var argumentsLength = arguments.length;
|
||||
var index = 1;
|
||||
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
||||
var propertyIsEnumerable = propertyIsEnumerableModule.f;
|
||||
while (argumentsLength > index) {
|
||||
var S = IndexedObject(arguments[index++]);
|
||||
var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
|
||||
var length = keys.length;
|
||||
var j = 0;
|
||||
var key;
|
||||
while (length > j) {
|
||||
key = keys[j++];
|
||||
if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
|
||||
}
|
||||
} return T;
|
||||
} : $assign;
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
'use strict';
|
||||
/* global ActiveXObject -- old IE, WSH */
|
||||
var anObject = require('../internals/an-object');
|
||||
var definePropertiesModule = require('../internals/object-define-properties');
|
||||
var enumBugKeys = require('../internals/enum-bug-keys');
|
||||
var hiddenKeys = require('../internals/hidden-keys');
|
||||
var html = require('../internals/html');
|
||||
var documentCreateElement = require('../internals/document-create-element');
|
||||
var sharedKey = require('../internals/shared-key');
|
||||
|
||||
var GT = '>';
|
||||
var LT = '<';
|
||||
var PROTOTYPE = 'prototype';
|
||||
var SCRIPT = 'script';
|
||||
var IE_PROTO = sharedKey('IE_PROTO');
|
||||
|
||||
var EmptyConstructor = function () { /* empty */ };
|
||||
|
||||
var scriptTag = function (content) {
|
||||
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
||||
};
|
||||
|
||||
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
|
||||
var NullProtoObjectViaActiveX = function (activeXDocument) {
|
||||
activeXDocument.write(scriptTag(''));
|
||||
activeXDocument.close();
|
||||
var temp = activeXDocument.parentWindow.Object;
|
||||
activeXDocument = null; // avoid memory leak
|
||||
return temp;
|
||||
};
|
||||
|
||||
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
||||
var NullProtoObjectViaIFrame = function () {
|
||||
// Thrash, waste and sodomy: IE GC bug
|
||||
var iframe = documentCreateElement('iframe');
|
||||
var JS = 'java' + SCRIPT + ':';
|
||||
var iframeDocument;
|
||||
iframe.style.display = 'none';
|
||||
html.appendChild(iframe);
|
||||
// https://github.com/zloirock/core-js/issues/475
|
||||
iframe.src = String(JS);
|
||||
iframeDocument = iframe.contentWindow.document;
|
||||
iframeDocument.open();
|
||||
iframeDocument.write(scriptTag('document.F=Object'));
|
||||
iframeDocument.close();
|
||||
return iframeDocument.F;
|
||||
};
|
||||
|
||||
// Check for document.domain and active x support
|
||||
// No need to use active x approach when document.domain is not set
|
||||
// see https://github.com/es-shims/es5-shim/issues/150
|
||||
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
||||
// avoid IE GC bug
|
||||
var activeXDocument;
|
||||
var NullProtoObject = function () {
|
||||
try {
|
||||
activeXDocument = new ActiveXObject('htmlfile');
|
||||
} catch (error) { /* ignore */ }
|
||||
NullProtoObject = typeof document != 'undefined'
|
||||
? document.domain && activeXDocument
|
||||
? NullProtoObjectViaActiveX(activeXDocument) // old IE
|
||||
: NullProtoObjectViaIFrame()
|
||||
: NullProtoObjectViaActiveX(activeXDocument); // WSH
|
||||
var length = enumBugKeys.length;
|
||||
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
|
||||
return NullProtoObject();
|
||||
};
|
||||
|
||||
hiddenKeys[IE_PROTO] = true;
|
||||
|
||||
// `Object.create` method
|
||||
// https://tc39.es/ecma262/#sec-object.create
|
||||
// eslint-disable-next-line es/no-object-create -- safe
|
||||
module.exports = Object.create || function create(O, Properties) {
|
||||
var result;
|
||||
if (O !== null) {
|
||||
EmptyConstructor[PROTOTYPE] = anObject(O);
|
||||
result = new EmptyConstructor();
|
||||
EmptyConstructor[PROTOTYPE] = null;
|
||||
// add "__proto__" for Object.getPrototypeOf polyfill
|
||||
result[IE_PROTO] = O;
|
||||
} else result = NullProtoObject();
|
||||
return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
|
||||
};
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
var DESCRIPTORS = require('../internals/descriptors');
|
||||
var V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');
|
||||
var definePropertyModule = require('../internals/object-define-property');
|
||||
var anObject = require('../internals/an-object');
|
||||
var toIndexedObject = require('../internals/to-indexed-object');
|
||||
var objectKeys = require('../internals/object-keys');
|
||||
|
||||
// `Object.defineProperties` method
|
||||
// https://tc39.es/ecma262/#sec-object.defineproperties
|
||||
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
||||
exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
|
||||
anObject(O);
|
||||
var props = toIndexedObject(Properties);
|
||||
var keys = objectKeys(Properties);
|
||||
var length = keys.length;
|
||||
var index = 0;
|
||||
var key;
|
||||
while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
|
||||
return O;
|
||||
};
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
var DESCRIPTORS = require('../internals/descriptors');
|
||||
var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
|
||||
var V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');
|
||||
var anObject = require('../internals/an-object');
|
||||
var toPropertyKey = require('../internals/to-property-key');
|
||||
|
||||
var $TypeError = TypeError;
|
||||
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
||||
var $defineProperty = Object.defineProperty;
|
||||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||||
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||||
var ENUMERABLE = 'enumerable';
|
||||
var CONFIGURABLE = 'configurable';
|
||||
var WRITABLE = 'writable';
|
||||
|
||||
// `Object.defineProperty` method
|
||||
// https://tc39.es/ecma262/#sec-object.defineproperty
|
||||
exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
|
||||
anObject(O);
|
||||
P = toPropertyKey(P);
|
||||
anObject(Attributes);
|
||||
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
||||
var current = $getOwnPropertyDescriptor(O, P);
|
||||
if (current && current[WRITABLE]) {
|
||||
O[P] = Attributes.value;
|
||||
Attributes = {
|
||||
configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
|
||||
enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
|
||||
writable: false
|
||||
};
|
||||
}
|
||||
} return $defineProperty(O, P, Attributes);
|
||||
} : $defineProperty : function defineProperty(O, P, Attributes) {
|
||||
anObject(O);
|
||||
P = toPropertyKey(P);
|
||||
anObject(Attributes);
|
||||
if (IE8_DOM_DEFINE) try {
|
||||
return $defineProperty(O, P, Attributes);
|
||||
} catch (error) { /* empty */ }
|
||||
if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');
|
||||
if ('value' in Attributes) O[P] = Attributes.value;
|
||||
return O;
|
||||
};
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
var DESCRIPTORS = require('../internals/descriptors');
|
||||
var call = require('../internals/function-call');
|
||||
var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
|
||||
var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
||||
var toIndexedObject = require('../internals/to-indexed-object');
|
||||
var toPropertyKey = require('../internals/to-property-key');
|
||||
var hasOwn = require('../internals/has-own-property');
|
||||
var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
|
||||
|
||||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||||
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||||
|
||||
// `Object.getOwnPropertyDescriptor` method
|
||||
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
||||
exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
||||
O = toIndexedObject(O);
|
||||
P = toPropertyKey(P);
|
||||
if (IE8_DOM_DEFINE) try {
|
||||
return $getOwnPropertyDescriptor(O, P);
|
||||
} catch (error) { /* empty */ }
|
||||
if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
|
||||
};
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
var internalObjectKeys = require('../internals/object-keys-internal');
|
||||
var enumBugKeys = require('../internals/enum-bug-keys');
|
||||
|
||||
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
||||
|
||||
// `Object.getOwnPropertyNames` method
|
||||
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
||||
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
||||
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
||||
return internalObjectKeys(O, hiddenKeys);
|
||||
};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
||||
exports.f = Object.getOwnPropertySymbols;
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
var hasOwn = require('../internals/has-own-property');
|
||||
var isCallable = require('../internals/is-callable');
|
||||
var toObject = require('../internals/to-object');
|
||||
var sharedKey = require('../internals/shared-key');
|
||||
var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');
|
||||
|
||||
var IE_PROTO = sharedKey('IE_PROTO');
|
||||
var $Object = Object;
|
||||
var ObjectPrototype = $Object.prototype;
|
||||
|
||||
// `Object.getPrototypeOf` method
|
||||
// https://tc39.es/ecma262/#sec-object.getprototypeof
|
||||
// eslint-disable-next-line es/no-object-getprototypeof -- safe
|
||||
module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
|
||||
var object = toObject(O);
|
||||
if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
|
||||
var constructor = object.constructor;
|
||||
if (isCallable(constructor) && object instanceof constructor) {
|
||||
return constructor.prototype;
|
||||
} return object instanceof $Object ? ObjectPrototype : null;
|
||||
};
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
|
||||
module.exports = uncurryThis({}.isPrototypeOf);
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
var hasOwn = require('../internals/has-own-property');
|
||||
var toIndexedObject = require('../internals/to-indexed-object');
|
||||
var indexOf = require('../internals/array-includes').indexOf;
|
||||
var hiddenKeys = require('../internals/hidden-keys');
|
||||
|
||||
var push = uncurryThis([].push);
|
||||
|
||||
module.exports = function (object, names) {
|
||||
var O = toIndexedObject(object);
|
||||
var i = 0;
|
||||
var result = [];
|
||||
var key;
|
||||
for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
|
||||
// Don't enum bug & hidden keys
|
||||
while (names.length > i) if (hasOwn(O, key = names[i++])) {
|
||||
~indexOf(result, key) || push(result, key);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
var internalObjectKeys = require('../internals/object-keys-internal');
|
||||
var enumBugKeys = require('../internals/enum-bug-keys');
|
||||
|
||||
// `Object.keys` method
|
||||
// https://tc39.es/ecma262/#sec-object.keys
|
||||
// eslint-disable-next-line es/no-object-keys -- safe
|
||||
module.exports = Object.keys || function keys(O) {
|
||||
return internalObjectKeys(O, enumBugKeys);
|
||||
};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
||||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||||
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||||
|
||||
// Nashorn ~ JDK8 bug
|
||||
var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
|
||||
|
||||
// `Object.prototype.propertyIsEnumerable` method implementation
|
||||
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
||||
exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
||||
var descriptor = getOwnPropertyDescriptor(this, V);
|
||||
return !!descriptor && descriptor.enumerable;
|
||||
} : $propertyIsEnumerable;
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
/* eslint-disable no-proto -- safe */
|
||||
var uncurryThisAccessor = require('../internals/function-uncurry-this-accessor');
|
||||
var isObject = require('../internals/is-object');
|
||||
var requireObjectCoercible = require('../internals/require-object-coercible');
|
||||
var aPossiblePrototype = require('../internals/a-possible-prototype');
|
||||
|
||||
// `Object.setPrototypeOf` method
|
||||
// https://tc39.es/ecma262/#sec-object.setprototypeof
|
||||
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
||||
// eslint-disable-next-line es/no-object-setprototypeof -- safe
|
||||
module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
||||
var CORRECT_SETTER = false;
|
||||
var test = {};
|
||||
var setter;
|
||||
try {
|
||||
setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
|
||||
setter(test, []);
|
||||
CORRECT_SETTER = test instanceof Array;
|
||||
} catch (error) { /* empty */ }
|
||||
return function setPrototypeOf(O, proto) {
|
||||
requireObjectCoercible(O);
|
||||
aPossiblePrototype(proto);
|
||||
if (!isObject(O)) return O;
|
||||
if (CORRECT_SETTER) setter(O, proto);
|
||||
else O.__proto__ = proto;
|
||||
return O;
|
||||
};
|
||||
}() : undefined);
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
var call = require('../internals/function-call');
|
||||
var isCallable = require('../internals/is-callable');
|
||||
var isObject = require('../internals/is-object');
|
||||
|
||||
var $TypeError = TypeError;
|
||||
|
||||
// `OrdinaryToPrimitive` abstract operation
|
||||
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
||||
module.exports = function (input, pref) {
|
||||
var fn, val;
|
||||
if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
|
||||
if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
|
||||
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
|
||||
throw new $TypeError("Can't convert object to primitive value");
|
||||
};
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
var getBuiltIn = require('../internals/get-built-in');
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');
|
||||
var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
|
||||
var anObject = require('../internals/an-object');
|
||||
|
||||
var concat = uncurryThis([].concat);
|
||||
|
||||
// all object keys, includes non-enumerable and symbols
|
||||
module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
||||
var keys = getOwnPropertyNamesModule.f(anObject(it));
|
||||
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
||||
return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
var isNullOrUndefined = require('../internals/is-null-or-undefined');
|
||||
|
||||
var $TypeError = TypeError;
|
||||
|
||||
// `RequireObjectCoercible` abstract operation
|
||||
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
||||
module.exports = function (it) {
|
||||
if (isNullOrUndefined(it)) throw new $TypeError("Can't call method on " + it);
|
||||
return it;
|
||||
};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
var global = require('../internals/global');
|
||||
var DESCRIPTORS = require('../internals/descriptors');
|
||||
|
||||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||||
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||||
|
||||
// Avoid NodeJS experimental warning
|
||||
module.exports = function (name) {
|
||||
if (!DESCRIPTORS) return global[name];
|
||||
var descriptor = getOwnPropertyDescriptor(global, name);
|
||||
return descriptor && descriptor.value;
|
||||
};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
var defineProperty = require('../internals/object-define-property').f;
|
||||
var hasOwn = require('../internals/has-own-property');
|
||||
var wellKnownSymbol = require('../internals/well-known-symbol');
|
||||
|
||||
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
||||
|
||||
module.exports = function (target, TAG, STATIC) {
|
||||
if (target && !STATIC) target = target.prototype;
|
||||
if (target && !hasOwn(target, TO_STRING_TAG)) {
|
||||
defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });
|
||||
}
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
var shared = require('../internals/shared');
|
||||
var uid = require('../internals/uid');
|
||||
|
||||
var keys = shared('keys');
|
||||
|
||||
module.exports = function (key) {
|
||||
return keys[key] || (keys[key] = uid(key));
|
||||
};
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
var IS_PURE = require('../internals/is-pure');
|
||||
var globalThis = require('../internals/global');
|
||||
var defineGlobalProperty = require('../internals/define-global-property');
|
||||
|
||||
var SHARED = '__core-js_shared__';
|
||||
var store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
|
||||
|
||||
(store.versions || (store.versions = [])).push({
|
||||
version: '3.37.1',
|
||||
mode: IS_PURE ? 'pure' : 'global',
|
||||
copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
|
||||
license: 'https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE',
|
||||
source: 'https://github.com/zloirock/core-js'
|
||||
});
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
var store = require('../internals/shared-store');
|
||||
|
||||
module.exports = function (key, value) {
|
||||
return store[key] || (store[key] = value || {});
|
||||
};
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
|
||||
var toString = require('../internals/to-string');
|
||||
var requireObjectCoercible = require('../internals/require-object-coercible');
|
||||
|
||||
var charAt = uncurryThis(''.charAt);
|
||||
var charCodeAt = uncurryThis(''.charCodeAt);
|
||||
var stringSlice = uncurryThis(''.slice);
|
||||
|
||||
var createMethod = function (CONVERT_TO_STRING) {
|
||||
return function ($this, pos) {
|
||||
var S = toString(requireObjectCoercible($this));
|
||||
var position = toIntegerOrInfinity(pos);
|
||||
var size = S.length;
|
||||
var first, second;
|
||||
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
||||
first = charCodeAt(S, position);
|
||||
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
||||
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
|
||||
? CONVERT_TO_STRING
|
||||
? charAt(S, position)
|
||||
: first
|
||||
: CONVERT_TO_STRING
|
||||
? stringSlice(S, position, position + 2)
|
||||
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
// `String.prototype.codePointAt` method
|
||||
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
|
||||
codeAt: createMethod(false),
|
||||
// `String.prototype.at` method
|
||||
// https://github.com/mathiasbynens/String.prototype.at
|
||||
charAt: createMethod(true)
|
||||
};
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
'use strict';
|
||||
// based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
|
||||
var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
|
||||
var base = 36;
|
||||
var tMin = 1;
|
||||
var tMax = 26;
|
||||
var skew = 38;
|
||||
var damp = 700;
|
||||
var initialBias = 72;
|
||||
var initialN = 128; // 0x80
|
||||
var delimiter = '-'; // '\x2D'
|
||||
var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars
|
||||
var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
|
||||
var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';
|
||||
var baseMinusTMin = base - tMin;
|
||||
|
||||
var $RangeError = RangeError;
|
||||
var exec = uncurryThis(regexSeparators.exec);
|
||||
var floor = Math.floor;
|
||||
var fromCharCode = String.fromCharCode;
|
||||
var charCodeAt = uncurryThis(''.charCodeAt);
|
||||
var join = uncurryThis([].join);
|
||||
var push = uncurryThis([].push);
|
||||
var replace = uncurryThis(''.replace);
|
||||
var split = uncurryThis(''.split);
|
||||
var toLowerCase = uncurryThis(''.toLowerCase);
|
||||
|
||||
/**
|
||||
* Creates an array containing the numeric code points of each Unicode
|
||||
* character in the string. While JavaScript uses UCS-2 internally,
|
||||
* this function will convert a pair of surrogate halves (each of which
|
||||
* UCS-2 exposes as separate characters) into a single code point,
|
||||
* matching UTF-16.
|
||||
*/
|
||||
var ucs2decode = function (string) {
|
||||
var output = [];
|
||||
var counter = 0;
|
||||
var length = string.length;
|
||||
while (counter < length) {
|
||||
var value = charCodeAt(string, counter++);
|
||||
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
||||
// It's a high surrogate, and there is a next character.
|
||||
var extra = charCodeAt(string, counter++);
|
||||
if ((extra & 0xFC00) === 0xDC00) { // Low surrogate.
|
||||
push(output, ((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
||||
} else {
|
||||
// It's an unmatched surrogate; only append this code unit, in case the
|
||||
// next code unit is the high surrogate of a surrogate pair.
|
||||
push(output, value);
|
||||
counter--;
|
||||
}
|
||||
} else {
|
||||
push(output, value);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a digit/integer into a basic code point.
|
||||
*/
|
||||
var digitToBasic = function (digit) {
|
||||
// 0..25 map to ASCII a..z or A..Z
|
||||
// 26..35 map to ASCII 0..9
|
||||
return digit + 22 + 75 * (digit < 26);
|
||||
};
|
||||
|
||||
/**
|
||||
* Bias adaptation function as per section 3.4 of RFC 3492.
|
||||
* https://tools.ietf.org/html/rfc3492#section-3.4
|
||||
*/
|
||||
var adapt = function (delta, numPoints, firstTime) {
|
||||
var k = 0;
|
||||
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
||||
delta += floor(delta / numPoints);
|
||||
while (delta > baseMinusTMin * tMax >> 1) {
|
||||
delta = floor(delta / baseMinusTMin);
|
||||
k += base;
|
||||
}
|
||||
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
||||
* Punycode string of ASCII-only symbols.
|
||||
*/
|
||||
var encode = function (input) {
|
||||
var output = [];
|
||||
|
||||
// Convert the input in UCS-2 to an array of Unicode code points.
|
||||
input = ucs2decode(input);
|
||||
|
||||
// Cache the length.
|
||||
var inputLength = input.length;
|
||||
|
||||
// Initialize the state.
|
||||
var n = initialN;
|
||||
var delta = 0;
|
||||
var bias = initialBias;
|
||||
var i, currentValue;
|
||||
|
||||
// Handle the basic code points.
|
||||
for (i = 0; i < input.length; i++) {
|
||||
currentValue = input[i];
|
||||
if (currentValue < 0x80) {
|
||||
push(output, fromCharCode(currentValue));
|
||||
}
|
||||
}
|
||||
|
||||
var basicLength = output.length; // number of basic code points.
|
||||
var handledCPCount = basicLength; // number of code points that have been handled;
|
||||
|
||||
// Finish the basic string with a delimiter unless it's empty.
|
||||
if (basicLength) {
|
||||
push(output, delimiter);
|
||||
}
|
||||
|
||||
// Main encoding loop:
|
||||
while (handledCPCount < inputLength) {
|
||||
// All non-basic code points < n have been handled already. Find the next larger one:
|
||||
var m = maxInt;
|
||||
for (i = 0; i < input.length; i++) {
|
||||
currentValue = input[i];
|
||||
if (currentValue >= n && currentValue < m) {
|
||||
m = currentValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, but guard against overflow.
|
||||
var handledCPCountPlusOne = handledCPCount + 1;
|
||||
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
||||
throw new $RangeError(OVERFLOW_ERROR);
|
||||
}
|
||||
|
||||
delta += (m - n) * handledCPCountPlusOne;
|
||||
n = m;
|
||||
|
||||
for (i = 0; i < input.length; i++) {
|
||||
currentValue = input[i];
|
||||
if (currentValue < n && ++delta > maxInt) {
|
||||
throw new $RangeError(OVERFLOW_ERROR);
|
||||
}
|
||||
if (currentValue === n) {
|
||||
// Represent delta as a generalized variable-length integer.
|
||||
var q = delta;
|
||||
var k = base;
|
||||
while (true) {
|
||||
var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
|
||||
if (q < t) break;
|
||||
var qMinusT = q - t;
|
||||
var baseMinusT = base - t;
|
||||
push(output, fromCharCode(digitToBasic(t + qMinusT % baseMinusT)));
|
||||
q = floor(qMinusT / baseMinusT);
|
||||
k += base;
|
||||
}
|
||||
|
||||
push(output, fromCharCode(digitToBasic(q)));
|
||||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
|
||||
delta = 0;
|
||||
handledCPCount++;
|
||||
}
|
||||
}
|
||||
|
||||
delta++;
|
||||
n++;
|
||||
}
|
||||
return join(output, '');
|
||||
};
|
||||
|
||||
module.exports = function (input) {
|
||||
var encoded = [];
|
||||
var labels = split(replace(toLowerCase(input), regexSeparators, '\u002E'), '.');
|
||||
var i, label;
|
||||
for (i = 0; i < labels.length; i++) {
|
||||
label = labels[i];
|
||||
push(encoded, exec(regexNonASCII, label) ? 'xn--' + encode(label) : label);
|
||||
}
|
||||
return join(encoded, '.');
|
||||
};
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
/* eslint-disable es/no-symbol -- required for testing */
|
||||
var V8_VERSION = require('../internals/engine-v8-version');
|
||||
var fails = require('../internals/fails');
|
||||
var global = require('../internals/global');
|
||||
|
||||
var $String = global.String;
|
||||
|
||||
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
||||
module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
|
||||
var symbol = Symbol('symbol detection');
|
||||
// Chrome 38 Symbol has incorrect toString conversion
|
||||
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
||||
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
||||
// of course, fail.
|
||||
return !$String(symbol) || !(Object(symbol) instanceof Symbol) ||
|
||||
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
||||
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
||||
});
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
|
||||
|
||||
var max = Math.max;
|
||||
var min = Math.min;
|
||||
|
||||
// Helper for a popular repeating case of the spec:
|
||||
// Let integer be ? ToInteger(index).
|
||||
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
|
||||
module.exports = function (index, length) {
|
||||
var integer = toIntegerOrInfinity(index);
|
||||
return integer < 0 ? max(integer + length, 0) : min(integer, length);
|
||||
};
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
// toObject with fallback for non-array-like ES3 strings
|
||||
var IndexedObject = require('../internals/indexed-object');
|
||||
var requireObjectCoercible = require('../internals/require-object-coercible');
|
||||
|
||||
module.exports = function (it) {
|
||||
return IndexedObject(requireObjectCoercible(it));
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
var trunc = require('../internals/math-trunc');
|
||||
|
||||
// `ToIntegerOrInfinity` abstract operation
|
||||
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
||||
module.exports = function (argument) {
|
||||
var number = +argument;
|
||||
// eslint-disable-next-line no-self-compare -- NaN check
|
||||
return number !== number || number === 0 ? 0 : trunc(number);
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
|
||||
|
||||
var min = Math.min;
|
||||
|
||||
// `ToLength` abstract operation
|
||||
// https://tc39.es/ecma262/#sec-tolength
|
||||
module.exports = function (argument) {
|
||||
var len = toIntegerOrInfinity(argument);
|
||||
return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
var requireObjectCoercible = require('../internals/require-object-coercible');
|
||||
|
||||
var $Object = Object;
|
||||
|
||||
// `ToObject` abstract operation
|
||||
// https://tc39.es/ecma262/#sec-toobject
|
||||
module.exports = function (argument) {
|
||||
return $Object(requireObjectCoercible(argument));
|
||||
};
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
var call = require('../internals/function-call');
|
||||
var isObject = require('../internals/is-object');
|
||||
var isSymbol = require('../internals/is-symbol');
|
||||
var getMethod = require('../internals/get-method');
|
||||
var ordinaryToPrimitive = require('../internals/ordinary-to-primitive');
|
||||
var wellKnownSymbol = require('../internals/well-known-symbol');
|
||||
|
||||
var $TypeError = TypeError;
|
||||
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
||||
|
||||
// `ToPrimitive` abstract operation
|
||||
// https://tc39.es/ecma262/#sec-toprimitive
|
||||
module.exports = function (input, pref) {
|
||||
if (!isObject(input) || isSymbol(input)) return input;
|
||||
var exoticToPrim = getMethod(input, TO_PRIMITIVE);
|
||||
var result;
|
||||
if (exoticToPrim) {
|
||||
if (pref === undefined) pref = 'default';
|
||||
result = call(exoticToPrim, input, pref);
|
||||
if (!isObject(result) || isSymbol(result)) return result;
|
||||
throw new $TypeError("Can't convert object to primitive value");
|
||||
}
|
||||
if (pref === undefined) pref = 'number';
|
||||
return ordinaryToPrimitive(input, pref);
|
||||
};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
var toPrimitive = require('../internals/to-primitive');
|
||||
var isSymbol = require('../internals/is-symbol');
|
||||
|
||||
// `ToPropertyKey` abstract operation
|
||||
// https://tc39.es/ecma262/#sec-topropertykey
|
||||
module.exports = function (argument) {
|
||||
var key = toPrimitive(argument, 'string');
|
||||
return isSymbol(key) ? key : key + '';
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
var wellKnownSymbol = require('../internals/well-known-symbol');
|
||||
|
||||
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
||||
var test = {};
|
||||
|
||||
test[TO_STRING_TAG] = 'z';
|
||||
|
||||
module.exports = String(test) === '[object z]';
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
var classof = require('../internals/classof');
|
||||
|
||||
var $String = String;
|
||||
|
||||
module.exports = function (argument) {
|
||||
if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
|
||||
return $String(argument);
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user