Comparing version 3.35.0 to 3.35.1
@@ -35,3 +35,3 @@ 'use strict'; | ||
} else { | ||
target = (global[TARGET] || {}).prototype; | ||
target = global[TARGET] && global[TARGET].prototype; | ||
} | ||
@@ -38,0 +38,0 @@ if (target) for (key in source) { |
'use strict'; | ||
// TODO: Remove from `core-js@4` since it's moved to entry points | ||
require('../modules/es.regexp.exec'); | ||
var uncurryThis = require('../internals/function-uncurry-this-clause'); | ||
var call = require('../internals/function-call'); | ||
var defineBuiltIn = require('../internals/define-built-in'); | ||
@@ -18,3 +18,3 @@ var regexpExec = require('../internals/regexp-exec'); | ||
var DELEGATES_TO_SYMBOL = !fails(function () { | ||
// String methods call symbol-named RegEp methods | ||
// String methods call symbol-named RegExp methods | ||
var O = {}; | ||
@@ -57,5 +57,4 @@ O[SYMBOL] = function () { return 7; }; | ||
) { | ||
var uncurriedNativeRegExpMethod = uncurryThis(/./[SYMBOL]); | ||
var nativeRegExpMethod = /./[SYMBOL]; | ||
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { | ||
var uncurriedNativeMethod = uncurryThis(nativeMethod); | ||
var $exec = regexp.exec; | ||
@@ -67,5 +66,5 @@ if ($exec === regexpExec || $exec === RegExpPrototype.exec) { | ||
// We avoid it by directly calling the native @@method method. | ||
return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) }; | ||
return { done: true, value: call(nativeRegExpMethod, regexp, str, arg2) }; | ||
} | ||
return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) }; | ||
return { done: true, value: call(nativeMethod, str, regexp, arg2) }; | ||
} | ||
@@ -72,0 +71,0 @@ return { done: false }; |
@@ -10,3 +10,2 @@ 'use strict'; | ||
var noop = function () { /* empty */ }; | ||
var empty = []; | ||
var construct = getBuiltIn('Reflect', 'construct'); | ||
@@ -20,3 +19,3 @@ var constructorRegExp = /^\s*(?:class|function)\b/; | ||
try { | ||
construct(noop, empty, argument); | ||
construct(noop, [], argument); | ||
return true; | ||
@@ -23,0 +22,0 @@ } catch (error) { |
@@ -28,3 +28,3 @@ 'use strict'; | ||
if (stringSlice($String(name), 0, 7) === 'Symbol(') { | ||
name = '[' + replace($String(name), /^Symbol\(([^)]*)\)/, '$1') + ']'; | ||
name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']'; | ||
} | ||
@@ -31,0 +31,0 @@ if (options && options.getter) name = 'get ' + name; |
@@ -8,7 +8,7 @@ 'use strict'; | ||
})('versions', []).push({ | ||
version: '3.35.0', | ||
version: '3.35.1', | ||
mode: IS_PURE ? 'pure' : 'global', | ||
copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)', | ||
license: 'https://github.com/zloirock/core-js/blob/v3.35.0/LICENSE', | ||
copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)', | ||
license: 'https://github.com/zloirock/core-js/blob/v3.35.1/LICENSE', | ||
source: 'https://github.com/zloirock/core-js' | ||
}); |
@@ -9,3 +9,4 @@ 'use strict'; | ||
module.exports = function (argument) { | ||
return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 | ||
var len = toIntegerOrInfinity(argument); | ||
return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 | ||
}; |
@@ -23,8 +23,2 @@ 'use strict'; | ||
var stringIndexOf = function (string, searchValue, fromIndex) { | ||
if (fromIndex > string.length) return -1; | ||
if (searchValue === '') return fromIndex; | ||
return indexOf(string, searchValue, fromIndex); | ||
}; | ||
// `String.prototype.replaceAll` method | ||
@@ -58,3 +52,3 @@ // https://tc39.es/ecma262/#sec-string.prototype.replaceall | ||
advanceBy = max(1, searchLength); | ||
position = stringIndexOf(string, searchString, 0); | ||
position = indexOf(string, searchString); | ||
while (position !== -1) { | ||
@@ -66,3 +60,3 @@ replacement = functionalReplace | ||
endOfLastMatch = position + searchLength; | ||
position = stringIndexOf(string, searchString, position + advanceBy); | ||
position = position + advanceBy > string.length ? -1 : indexOf(string, searchString, position + advanceBy); | ||
} | ||
@@ -69,0 +63,0 @@ if (endOfLastMatch < string.length) { |
'use strict'; | ||
var apply = require('../internals/function-apply'); | ||
var call = require('../internals/function-call'); | ||
@@ -8,3 +7,2 @@ var uncurryThis = require('../internals/function-uncurry-this'); | ||
var isNullOrUndefined = require('../internals/is-null-or-undefined'); | ||
var isRegExp = require('../internals/is-regexp'); | ||
var requireObjectCoercible = require('../internals/require-object-coercible'); | ||
@@ -16,5 +14,3 @@ var speciesConstructor = require('../internals/species-constructor'); | ||
var getMethod = require('../internals/get-method'); | ||
var arraySlice = require('../internals/array-slice'); | ||
var callRegExpExec = require('../internals/regexp-exec-abstract'); | ||
var regexpExec = require('../internals/regexp-exec'); | ||
var regExpExec = require('../internals/regexp-exec-abstract'); | ||
var stickyHelpers = require('../internals/regexp-sticky-helpers'); | ||
@@ -26,5 +22,3 @@ var fails = require('../internals/fails'); | ||
var min = Math.min; | ||
var $push = [].push; | ||
var exec = uncurryThis(/./.exec); | ||
var push = uncurryThis($push); | ||
var push = uncurryThis([].push); | ||
var stringSlice = uncurryThis(''.slice); | ||
@@ -43,56 +37,16 @@ | ||
var BUGGY = 'abbc'.split(/(b)*/)[1] === 'c' || | ||
// eslint-disable-next-line regexp/no-empty-group -- required for testing | ||
'test'.split(/(?:)/, -1).length !== 4 || | ||
'ab'.split(/(?:ab)*/).length !== 2 || | ||
'.'.split(/(.?)(.?)/).length !== 4 || | ||
// eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing | ||
'.'.split(/()()/).length > 1 || | ||
''.split(/.?/).length; | ||
// @@split logic | ||
fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) { | ||
var internalSplit; | ||
if ( | ||
'abbc'.split(/(b)*/)[1] === 'c' || | ||
// eslint-disable-next-line regexp/no-empty-group -- required for testing | ||
'test'.split(/(?:)/, -1).length !== 4 || | ||
'ab'.split(/(?:ab)*/).length !== 2 || | ||
'.'.split(/(.?)(.?)/).length !== 4 || | ||
// eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing | ||
'.'.split(/()()/).length > 1 || | ||
''.split(/.?/).length | ||
) { | ||
// based on es5-shim implementation, need to rework it | ||
internalSplit = function (separator, limit) { | ||
var string = toString(requireObjectCoercible(this)); | ||
var lim = limit === undefined ? MAX_UINT32 : limit >>> 0; | ||
if (lim === 0) return []; | ||
if (separator === undefined) return [string]; | ||
// If `separator` is not a regex, use native split | ||
if (!isRegExp(separator)) { | ||
return call(nativeSplit, string, separator, lim); | ||
} | ||
var output = []; | ||
var flags = (separator.ignoreCase ? 'i' : '') + | ||
(separator.multiline ? 'm' : '') + | ||
(separator.unicode ? 'u' : '') + | ||
(separator.sticky ? 'y' : ''); | ||
var lastLastIndex = 0; | ||
// Make `global` and avoid `lastIndex` issues by working with a copy | ||
var separatorCopy = new RegExp(separator.source, flags + 'g'); | ||
var match, lastIndex, lastLength; | ||
while (match = call(regexpExec, separatorCopy, string)) { | ||
lastIndex = separatorCopy.lastIndex; | ||
if (lastIndex > lastLastIndex) { | ||
push(output, stringSlice(string, lastLastIndex, match.index)); | ||
if (match.length > 1 && match.index < string.length) apply($push, output, arraySlice(match, 1)); | ||
lastLength = match[0].length; | ||
lastLastIndex = lastIndex; | ||
if (output.length >= lim) break; | ||
} | ||
if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop | ||
} | ||
if (lastLastIndex === string.length) { | ||
if (lastLength || !exec(separatorCopy, '')) push(output, ''); | ||
} else push(output, stringSlice(string, lastLastIndex)); | ||
return output.length > lim ? arraySlice(output, 0, lim) : output; | ||
}; | ||
// Chakra, V8 | ||
} else if ('0'.split(undefined, 0).length) { | ||
internalSplit = function (separator, limit) { | ||
return separator === undefined && limit === 0 ? [] : call(nativeSplit, this, separator, limit); | ||
}; | ||
} else internalSplit = nativeSplit; | ||
var internalSplit = '0'.split(undefined, 0).length ? function (separator, limit) { | ||
return separator === undefined && limit === 0 ? [] : call(nativeSplit, this, separator, limit); | ||
} : nativeSplit; | ||
@@ -117,8 +71,9 @@ return [ | ||
var S = toString(string); | ||
var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit); | ||
if (res.done) return res.value; | ||
if (!BUGGY) { | ||
var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit); | ||
if (res.done) return res.value; | ||
} | ||
var C = speciesConstructor(rx, RegExp); | ||
var unicodeMatching = rx.unicode; | ||
@@ -129,3 +84,2 @@ var flags = (rx.ignoreCase ? 'i' : '') + | ||
(UNSUPPORTED_Y ? 'g' : 'y'); | ||
// ^(? + rx + ) is needed, in combination with some S slicing, to | ||
@@ -136,3 +90,3 @@ // simulate the 'y' flag. | ||
if (lim === 0) return []; | ||
if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : []; | ||
if (S.length === 0) return regExpExec(splitter, S) === null ? [S] : []; | ||
var p = 0; | ||
@@ -143,3 +97,3 @@ var q = 0; | ||
splitter.lastIndex = UNSUPPORTED_Y ? 0 : q; | ||
var z = callRegExpExec(splitter, UNSUPPORTED_Y ? stringSlice(S, q) : S); | ||
var z = regExpExec(splitter, UNSUPPORTED_Y ? stringSlice(S, q) : S); | ||
var e; | ||
@@ -165,2 +119,2 @@ if ( | ||
]; | ||
}, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y); | ||
}, BUGGY || !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y); |
{ | ||
"name": "core-js", | ||
"version": "3.35.0", | ||
"version": "3.35.1", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "description": "Standard library", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1207706
30005