core-js-pure
Advanced tools
Comparing version 3.34.0 to 3.35.0
'use strict'; | ||
var isCallable = require('../internals/is-callable'); | ||
var isPossiblePrototype = require('../internals/is-possible-prototype'); | ||
@@ -8,4 +8,4 @@ var $String = String; | ||
module.exports = function (argument) { | ||
if (typeof argument == 'object' || isCallable(argument)) return argument; | ||
if (isPossiblePrototype(argument)) return argument; | ||
throw new $TypeError("Can't set " + $String(argument) + ' as a prototype'); | ||
}; |
'use strict'; | ||
var arraySlice = require('../internals/array-slice-simple'); | ||
var arraySlice = require('../internals/array-slice'); | ||
var floor = Math.floor; | ||
var mergeSort = function (array, comparefn) { | ||
var sort = function (array, comparefn) { | ||
var length = array.length; | ||
var middle = floor(length / 2); | ||
return length < 8 ? insertionSort(array, comparefn) : merge( | ||
array, | ||
mergeSort(arraySlice(array, 0, middle), comparefn), | ||
mergeSort(arraySlice(array, middle), comparefn), | ||
comparefn | ||
); | ||
}; | ||
var insertionSort = function (array, comparefn) { | ||
var length = array.length; | ||
var i = 1; | ||
var element, j; | ||
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]; | ||
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; | ||
} | ||
if (j !== i++) array[j] = element; | ||
} return array; | ||
}; | ||
} 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; | ||
var merge = function (array, left, right, 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++]; | ||
} | ||
} | ||
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; | ||
return array; | ||
}; | ||
module.exports = mergeSort; | ||
module.exports = sort; |
'use strict'; | ||
// https://tc39.github.io/proposal-setmap-offrom/ | ||
var bind = require('../internals/function-bind-context'); | ||
var call = require('../internals/function-call'); | ||
var aCallable = require('../internals/a-callable'); | ||
var aConstructor = require('../internals/a-constructor'); | ||
var isNullOrUndefined = require('../internals/is-null-or-undefined'); | ||
var anObject = require('../internals/an-object'); | ||
var toObject = require('../internals/to-object'); | ||
var iterate = require('../internals/iterate'); | ||
var push = [].push; | ||
module.exports = function from(source /* , mapFn, thisArg */) { | ||
var length = arguments.length; | ||
var mapFn = length > 1 ? arguments[1] : undefined; | ||
var mapping, array, n, boundFunction; | ||
aConstructor(this); | ||
mapping = mapFn !== undefined; | ||
if (mapping) aCallable(mapFn); | ||
if (isNullOrUndefined(source)) return new this(); | ||
array = []; | ||
if (mapping) { | ||
n = 0; | ||
boundFunction = bind(mapFn, length > 2 ? arguments[2] : undefined); | ||
iterate(source, function (nextItem) { | ||
call(push, array, boundFunction(nextItem, n++)); | ||
module.exports = function (C, adder, ENTRY) { | ||
return function from(source /* , mapFn, thisArg */) { | ||
var O = toObject(source); | ||
var length = arguments.length; | ||
var mapFn = length > 1 ? arguments[1] : undefined; | ||
var mapping = mapFn !== undefined; | ||
var boundFunction = mapping ? bind(mapFn, length > 2 ? arguments[2] : undefined) : undefined; | ||
var result = new C(); | ||
var n = 0; | ||
iterate(O, function (nextItem) { | ||
var entry = mapping ? boundFunction(nextItem, n++) : nextItem; | ||
if (ENTRY) adder(result, anObject(entry)[0], entry[1]); | ||
else adder(result, entry); | ||
}); | ||
} else { | ||
iterate(source, push, { that: array }); | ||
} | ||
return new this(array); | ||
return result; | ||
}; | ||
}; |
'use strict'; | ||
var arraySlice = require('../internals/array-slice'); | ||
var anObject = require('../internals/an-object'); | ||
// https://tc39.github.io/proposal-setmap-offrom/ | ||
module.exports = function of() { | ||
return new this(arraySlice(arguments)); | ||
module.exports = function (C, adder, ENTRY) { | ||
return function of() { | ||
var result = new C(); | ||
var length = arguments.length; | ||
for (var index = 0; index < length; index++) { | ||
var entry = arguments[index]; | ||
if (ENTRY) adder(result, anObject(entry)[0], entry[1]); | ||
else adder(result, entry); | ||
} return result; | ||
}; | ||
}; |
@@ -83,3 +83,2 @@ 'use strict'; | ||
var state = getInternalState(that); | ||
var data = state.index; | ||
var entry = state.first; | ||
@@ -89,6 +88,6 @@ while (entry) { | ||
if (entry.previous) entry.previous = entry.previous.next = undefined; | ||
delete data[entry.index]; | ||
entry = entry.next; | ||
} | ||
state.first = state.last = undefined; | ||
state.index = create(null); | ||
if (DESCRIPTORS) state.size = 0; | ||
@@ -95,0 +94,0 @@ else that.size = 0; |
@@ -13,7 +13,7 @@ 'use strict'; | ||
var SetRecord = function (set, size, has, keys) { | ||
var SetRecord = function (set, intSize) { | ||
this.set = set; | ||
this.size = size; | ||
this.has = has; | ||
this.keys = keys; | ||
this.size = max(intSize, 0); | ||
this.has = aCallable(set.has); | ||
this.keys = aCallable(set.keys); | ||
}; | ||
@@ -40,8 +40,3 @@ | ||
if (intSize < 0) throw new $RangeError(INVALID_SIZE); | ||
return new SetRecord( | ||
obj, | ||
max(intSize, 0), | ||
aCallable(obj.has), | ||
aCallable(obj.keys) | ||
); | ||
return new SetRecord(obj, intSize); | ||
}; |
'use strict'; | ||
var $documentAll = require('../internals/document-all'); | ||
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot | ||
var documentAll = typeof document == 'object' && document.all; | ||
var documentAll = $documentAll.all; | ||
// `IsCallable` abstract operation | ||
// https://tc39.es/ecma262/#sec-iscallable | ||
module.exports = $documentAll.IS_HTMLDDA ? function (argument) { | ||
// 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; | ||
@@ -10,0 +10,0 @@ } : function (argument) { |
'use strict'; | ||
var isCallable = require('../internals/is-callable'); | ||
var $documentAll = require('../internals/document-all'); | ||
var documentAll = $documentAll.all; | ||
module.exports = $documentAll.IS_HTMLDDA ? function (it) { | ||
return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll; | ||
} : function (it) { | ||
module.exports = function (it) { | ||
return typeof it == 'object' ? it !== null : isCallable(it); | ||
}; |
'use strict'; | ||
var global = require('../internals/global'); | ||
var safeGetBuiltIn = require('../internals/safe-get-built-in'); | ||
var bind = require('../internals/function-bind-context'); | ||
var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f; | ||
var macrotask = require('../internals/task').set; | ||
@@ -16,5 +16,3 @@ var Queue = require('../internals/queue'); | ||
var Promise = global.Promise; | ||
// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask` | ||
var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask'); | ||
var microtask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value; | ||
var microtask = safeGetBuiltIn('queueMicrotask'); | ||
var notify, toggle, node, promise, then; | ||
@@ -21,0 +19,0 @@ |
@@ -6,3 +6,3 @@ 'use strict'; | ||
var $getOwnPropertyNames = require('../internals/object-get-own-property-names').f; | ||
var arraySlice = require('../internals/array-slice-simple'); | ||
var arraySlice = require('../internals/array-slice'); | ||
@@ -9,0 +9,0 @@ var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames |
@@ -8,7 +8,7 @@ 'use strict'; | ||
})('versions', []).push({ | ||
version: '3.34.0', | ||
version: '3.35.0', | ||
mode: IS_PURE ? 'pure' : 'global', | ||
copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)', | ||
license: 'https://github.com/zloirock/core-js/blob/v3.34.0/LICENSE', | ||
license: 'https://github.com/zloirock/core-js/blob/v3.35.0/LICENSE', | ||
source: 'https://github.com/zloirock/core-js' | ||
}); |
@@ -13,3 +13,3 @@ 'use strict'; | ||
// V8 and Safari <= 15.4, FF < 23 throws InternalError | ||
// V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError | ||
// https://bugs.chromium.org/p/v8/issues/detail?id=12681 | ||
@@ -16,0 +16,0 @@ var properErrorOnNonWritableLength = function () { |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var definePropertyModule = require('../internals/object-define-property'); | ||
var getPrototypeOf = require('../internals/object-get-prototype-of'); | ||
var isPrototypeOf = require('../internals/object-is-prototype-of'); | ||
var wellKnownSymbol = require('../internals/well-known-symbol'); | ||
@@ -19,7 +19,4 @@ var makeBuiltIn = require('../internals/make-built-in'); | ||
var P = this.prototype; | ||
if (!isObject(P)) return O instanceof this; | ||
// for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: | ||
while (O = getPrototypeOf(O)) if (P === O) return true; | ||
return false; | ||
return isObject(P) ? isPrototypeOf(P, O) : O instanceof this; | ||
}, HAS_INSTANCE) }); | ||
} |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var call = require('../internals/function-call'); | ||
var newPromiseCapabilityModule = require('../internals/new-promise-capability'); | ||
@@ -12,5 +11,6 @@ var FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR; | ||
var capability = newPromiseCapabilityModule.f(this); | ||
call(capability.reject, undefined, r); | ||
var capabilityReject = capability.reject; | ||
capabilityReject(r); | ||
return capability.promise; | ||
} | ||
}); |
@@ -12,4 +12,2 @@ 'use strict'; | ||
// eslint-disable-next-line es/no-string-prototype-endswith -- safe | ||
var nativeEndsWith = uncurryThis(''.endsWith); | ||
var slice = uncurryThis(''.slice); | ||
@@ -35,6 +33,4 @@ var min = Math.min; | ||
var search = toString(searchString); | ||
return nativeEndsWith | ||
? nativeEndsWith(that, search, end) | ||
: slice(that, end - search.length, end) === search; | ||
return slice(that, end - search.length, end) === search; | ||
} | ||
}); |
@@ -12,4 +12,2 @@ 'use strict'; | ||
// eslint-disable-next-line es/no-string-prototype-startswith -- safe | ||
var nativeStartsWith = uncurryThis(''.startsWith); | ||
var stringSlice = uncurryThis(''.slice); | ||
@@ -33,6 +31,4 @@ var min = Math.min; | ||
var search = toString(searchString); | ||
return nativeStartsWith | ||
? nativeStartsWith(that, search, index) | ||
: stringSlice(that, index, index + search.length) === search; | ||
return stringSlice(that, index, index + search.length) === search; | ||
} | ||
}); |
@@ -100,3 +100,3 @@ 'use strict'; | ||
if (!Attributes.enumerable) { | ||
if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {})); | ||
if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, nativeObjectCreate(null))); | ||
O[HIDDEN][key] = true; | ||
@@ -103,0 +103,0 @@ } else { |
@@ -28,4 +28,2 @@ 'use strict'; | ||
var FROZEN = {}; | ||
var SEALED = {}; | ||
var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; | ||
@@ -101,8 +99,7 @@ var InternalWeakMap; | ||
if (isArray(key)) { | ||
if (isFrozen(key)) arrayIntegrityLevel = FROZEN; | ||
else if (isSealed(key)) arrayIntegrityLevel = SEALED; | ||
if (isFrozen(key)) arrayIntegrityLevel = freeze; | ||
else if (isSealed(key)) arrayIntegrityLevel = seal; | ||
} | ||
nativeSet(this, key, value); | ||
if (arrayIntegrityLevel === FROZEN) freeze(key); | ||
if (arrayIntegrityLevel === SEALED) seal(key); | ||
if (arrayIntegrityLevel) arrayIntegrityLevel(key); | ||
return this; | ||
@@ -109,0 +106,0 @@ } |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var from = require('../internals/collection-from'); | ||
var MapHelpers = require('../internals/map-helpers'); | ||
var createCollectionFrom = require('../internals/collection-from'); | ||
@@ -8,3 +9,3 @@ // `Map.from` method | ||
$({ target: 'Map', stat: true, forced: true }, { | ||
from: from | ||
from: createCollectionFrom(MapHelpers.Map, MapHelpers.set, true) | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var of = require('../internals/collection-of'); | ||
var MapHelpers = require('../internals/map-helpers'); | ||
var createCollectionOf = require('../internals/collection-of'); | ||
@@ -8,3 +9,3 @@ // `Map.of` method | ||
$({ target: 'Map', stat: true, forced: true }, { | ||
of: of | ||
of: createCollectionOf(MapHelpers.Map, MapHelpers.set, true) | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var from = require('../internals/collection-from'); | ||
var SetHelpers = require('../internals/set-helpers'); | ||
var createCollectionFrom = require('../internals/collection-from'); | ||
@@ -8,3 +9,3 @@ // `Set.from` method | ||
$({ target: 'Set', stat: true, forced: true }, { | ||
from: from | ||
from: createCollectionFrom(SetHelpers.Set, SetHelpers.add, false) | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var of = require('../internals/collection-of'); | ||
var SetHelpers = require('../internals/set-helpers'); | ||
var createCollectionOf = require('../internals/collection-of'); | ||
@@ -8,3 +9,3 @@ // `Set.of` method | ||
$({ target: 'Set', stat: true, forced: true }, { | ||
of: of | ||
of: createCollectionOf(SetHelpers.Set, SetHelpers.add, false) | ||
}); |
@@ -12,3 +12,3 @@ 'use strict'; | ||
var defineProperty = require('../internals/object-define-property').f; | ||
var createArrayFromList = require('../internals/array-slice-simple'); | ||
var createArrayFromList = require('../internals/array-slice'); | ||
var WeakMapHelpers = require('../internals/weak-map-helpers'); | ||
@@ -15,0 +15,0 @@ var cooked = require('../internals/string-cooked'); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var from = require('../internals/collection-from'); | ||
var WeakMapHelpers = require('../internals/weak-map-helpers'); | ||
var createCollectionFrom = require('../internals/collection-from'); | ||
@@ -8,3 +9,3 @@ // `WeakMap.from` method | ||
$({ target: 'WeakMap', stat: true, forced: true }, { | ||
from: from | ||
from: createCollectionFrom(WeakMapHelpers.WeakMap, WeakMapHelpers.set, true) | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var of = require('../internals/collection-of'); | ||
var WeakMapHelpers = require('../internals/weak-map-helpers'); | ||
var createCollectionOf = require('../internals/collection-of'); | ||
@@ -8,3 +9,3 @@ // `WeakMap.of` method | ||
$({ target: 'WeakMap', stat: true, forced: true }, { | ||
of: of | ||
of: createCollectionOf(WeakMapHelpers.WeakMap, WeakMapHelpers.set, true) | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var from = require('../internals/collection-from'); | ||
var WeakSetHelpers = require('../internals/weak-set-helpers'); | ||
var createCollectionFrom = require('../internals/collection-from'); | ||
@@ -8,3 +9,3 @@ // `WeakSet.from` method | ||
$({ target: 'WeakSet', stat: true, forced: true }, { | ||
from: from | ||
from: createCollectionFrom(WeakSetHelpers.WeakSet, WeakSetHelpers.add, false) | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var of = require('../internals/collection-of'); | ||
var WeakSetHelpers = require('../internals/weak-set-helpers'); | ||
var createCollectionOf = require('../internals/collection-of'); | ||
@@ -8,3 +9,3 @@ // `WeakSet.of` method | ||
$({ target: 'WeakSet', stat: true, forced: true }, { | ||
of: of | ||
of: createCollectionOf(WeakSetHelpers.WeakSet, WeakSetHelpers.add, false) | ||
}); |
'use strict'; | ||
var $ = require('../internals/export'); | ||
var global = require('../internals/global'); | ||
var microtask = require('../internals/microtask'); | ||
var aCallable = require('../internals/a-callable'); | ||
var validateArgumentsLength = require('../internals/validate-arguments-length'); | ||
var IS_NODE = require('../internals/engine-is-node'); | ||
var process = global.process; | ||
// `queueMicrotask` method | ||
@@ -16,6 +12,4 @@ // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask | ||
validateArgumentsLength(arguments.length, 1); | ||
aCallable(fn); | ||
var domain = IS_NODE && process.domain; | ||
microtask(domain ? domain.bind(fn) : fn); | ||
microtask(aCallable(fn)); | ||
} | ||
}); |
@@ -6,2 +6,3 @@ 'use strict'; | ||
var global = require('../internals/global'); | ||
var safeGetBuiltIn = require('../internals/safe-get-built-in'); | ||
var call = require('../internals/function-call'); | ||
@@ -40,12 +41,3 @@ var uncurryThis = require('../internals/function-uncurry-this'); | ||
var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR); | ||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe | ||
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | ||
// Avoid NodeJS experimental warning | ||
var safeGetBuiltIn = function (name) { | ||
if (!DESCRIPTORS) return global[name]; | ||
var descriptor = getOwnPropertyDescriptor(global, name); | ||
return descriptor && descriptor.value; | ||
}; | ||
var nativeFetch = safeGetBuiltIn('fetch'); | ||
@@ -52,0 +44,0 @@ var NativeRequest = safeGetBuiltIn('Request'); |
@@ -16,3 +16,3 @@ 'use strict'; | ||
var arrayFrom = require('../internals/array-from'); | ||
var arraySlice = require('../internals/array-slice-simple'); | ||
var arraySlice = require('../internals/array-slice'); | ||
var codeAt = require('../internals/string-multibyte').codeAt; | ||
@@ -19,0 +19,0 @@ var toASCII = require('../internals/string-punycode-to-ascii'); |
{ | ||
"name": "core-js-pure", | ||
"version": "3.34.0", | ||
"version": "3.35.0", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "description": "Standard library", |
3438
1067539
26921