Comparing version 3.14.0 to 3.15.0
@@ -0,4 +1,7 @@ | ||
require('../../modules/es.date.get-year'); | ||
require('../../modules/es.date.now'); | ||
require('../../modules/es.date.set-year'); | ||
require('../../modules/es.date.to-gmt-string'); | ||
require('../../modules/es.date.to-iso-string'); | ||
require('../../modules/es.date.to-json'); | ||
require('../../modules/es.date.to-iso-string'); | ||
require('../../modules/es.date.to-string'); | ||
@@ -5,0 +8,0 @@ require('../../modules/es.date.to-primitive'); |
@@ -50,3 +50,6 @@ require('../modules/es.symbol'); | ||
require('../modules/es.data-view'); | ||
require('../modules/es.date.get-year'); | ||
require('../modules/es.date.now'); | ||
require('../modules/es.date.set-year'); | ||
require('../modules/es.date.to-gmt-string'); | ||
require('../modules/es.date.to-iso-string'); | ||
@@ -56,2 +59,3 @@ require('../modules/es.date.to-json'); | ||
require('../modules/es.date.to-string'); | ||
require('../modules/es.escape'); | ||
require('../modules/es.function.bind'); | ||
@@ -140,2 +144,3 @@ require('../modules/es.function.has-instance'); | ||
require('../modules/es.regexp.constructor'); | ||
require('../modules/es.regexp.dot-all'); | ||
require('../modules/es.regexp.exec'); | ||
@@ -163,2 +168,3 @@ require('../modules/es.regexp.flags'); | ||
require('../modules/es.string.starts-with'); | ||
require('../modules/es.string.substr'); | ||
require('../modules/es.string.trim'); | ||
@@ -214,2 +220,3 @@ require('../modules/es.string.trim-end'); | ||
require('../modules/es.typed-array.to-string'); | ||
require('../modules/es.unescape'); | ||
require('../modules/es.weak-map'); | ||
@@ -216,0 +223,0 @@ require('../modules/es.weak-set'); |
require('../../modules/es.regexp.constructor'); | ||
require('../../modules/es.regexp.to-string'); | ||
require('../../modules/es.regexp.dot-all'); | ||
require('../../modules/es.regexp.exec'); | ||
@@ -4,0 +5,0 @@ require('../../modules/es.regexp.flags'); |
@@ -0,1 +1,3 @@ | ||
require('../../modules/es.regexp.constructor'); | ||
require('../../modules/es.regexp.exec'); | ||
require('../../modules/es.regexp.sticky'); | ||
@@ -2,0 +4,0 @@ |
@@ -17,2 +17,3 @@ require('../../modules/es.regexp.exec'); | ||
require('../../modules/es.string.starts-with'); | ||
require('../../modules/es.string.substr'); | ||
require('../../modules/es.string.trim'); | ||
@@ -19,0 +20,0 @@ require('../../modules/es.string.trim-start'); |
@@ -14,2 +14,3 @@ require('../../../modules/es.string.code-point-at'); | ||
require('../../../modules/es.string.starts-with'); | ||
require('../../../modules/es.string.substr'); | ||
require('../../../modules/es.string.trim'); | ||
@@ -16,0 +17,0 @@ require('../../../modules/es.string.trim-start'); |
@@ -50,3 +50,6 @@ require('../modules/es.symbol'); | ||
require('../modules/es.data-view'); | ||
require('../modules/es.date.get-year'); | ||
require('../modules/es.date.now'); | ||
require('../modules/es.date.set-year'); | ||
require('../modules/es.date.to-gmt-string'); | ||
require('../modules/es.date.to-iso-string'); | ||
@@ -56,2 +59,3 @@ require('../modules/es.date.to-json'); | ||
require('../modules/es.date.to-string'); | ||
require('../modules/es.escape'); | ||
require('../modules/es.function.bind'); | ||
@@ -140,2 +144,3 @@ require('../modules/es.function.has-instance'); | ||
require('../modules/es.regexp.constructor'); | ||
require('../modules/es.regexp.dot-all'); | ||
require('../modules/es.regexp.exec'); | ||
@@ -163,2 +168,3 @@ require('../modules/es.regexp.flags'); | ||
require('../modules/es.string.starts-with'); | ||
require('../modules/es.string.substr'); | ||
require('../modules/es.string.trim'); | ||
@@ -214,2 +220,3 @@ require('../modules/es.string.trim-end'); | ||
require('../modules/es.typed-array.to-string'); | ||
require('../modules/es.unescape'); | ||
require('../modules/es.weak-map'); | ||
@@ -216,0 +223,0 @@ require('../modules/es.weak-set'); |
@@ -13,43 +13,3 @@ 'use strict'; | ||
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { | ||
// #replace needs built-in support for named groups. | ||
// #match works fine because it just return the exec results, even if it has | ||
// a "grops" property. | ||
var re = /./; | ||
re.exec = function () { | ||
var result = []; | ||
result.groups = { a: '7' }; | ||
return result; | ||
}; | ||
return ''.replace(re, '$<a>') !== '7'; | ||
}); | ||
// IE <= 11 replaces $0 with the whole match, as if it was $& | ||
// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0 | ||
var REPLACE_KEEPS_$0 = (function () { | ||
// eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing | ||
return 'a'.replace(/./, '$0') === '$0'; | ||
})(); | ||
var REPLACE = wellKnownSymbol('replace'); | ||
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string | ||
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () { | ||
if (/./[REPLACE]) { | ||
return /./[REPLACE]('a', '$0') === ''; | ||
} | ||
return false; | ||
})(); | ||
// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec | ||
// Weex JS has frozen built-in prototypes, so use try / catch wrapper | ||
var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () { | ||
// eslint-disable-next-line regexp/no-empty-group -- required for testing | ||
var re = /(?:)/; | ||
var originalExec = re.exec; | ||
re.exec = function () { return originalExec.apply(this, arguments); }; | ||
var result = 'ab'.split(re); | ||
return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b'; | ||
}); | ||
module.exports = function (KEY, length, exec, sham) { | ||
module.exports = function (KEY, exec, FORCED, SHAM) { | ||
var SYMBOL = wellKnownSymbol(KEY); | ||
@@ -91,8 +51,3 @@ | ||
!DELEGATES_TO_EXEC || | ||
(KEY === 'replace' && !( | ||
REPLACE_SUPPORTS_NAMED_GROUPS && | ||
REPLACE_KEEPS_$0 && | ||
!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE | ||
)) || | ||
(KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) | ||
FORCED | ||
) { | ||
@@ -112,21 +67,9 @@ var nativeRegExpMethod = /./[SYMBOL]; | ||
return { done: false }; | ||
}, { | ||
REPLACE_KEEPS_$0: REPLACE_KEEPS_$0, | ||
REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE | ||
}); | ||
var stringMethod = methods[0]; | ||
var regexMethod = methods[1]; | ||
redefine(String.prototype, KEY, stringMethod); | ||
redefine(RegExpPrototype, SYMBOL, length == 2 | ||
// 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) | ||
// 21.2.5.11 RegExp.prototype[@@split](string, limit) | ||
? function (string, arg) { return regexMethod.call(string, this, arg); } | ||
// 21.2.5.6 RegExp.prototype[@@match](string) | ||
// 21.2.5.9 RegExp.prototype[@@search](string) | ||
: function (string) { return regexMethod.call(string, this); } | ||
); | ||
redefine(String.prototype, KEY, methods[0]); | ||
redefine(RegExpPrototype, SYMBOL, methods[1]); | ||
} | ||
if (sham) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true); | ||
if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true); | ||
}; |
'use strict'; | ||
/* eslint-disable regexp/no-assertion-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */ | ||
/* eslint-disable regexp/no-useless-quantifier -- testing */ | ||
var regexpFlags = require('./regexp-flags'); | ||
var stickyHelpers = require('./regexp-sticky-helpers'); | ||
var shared = require('./shared'); | ||
var regexpFlags = require('../internals/regexp-flags'); | ||
var stickyHelpers = require('../internals/regexp-sticky-helpers'); | ||
var shared = require('../internals/shared'); | ||
var create = require('../internals/object-create'); | ||
var getInternalState = require('../internals/internal-state').get; | ||
var UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all'); | ||
var UNSUPPORTED_NCG = require('../internals/regexp-unsupported-ncg'); | ||
@@ -26,8 +30,20 @@ var nativeExec = RegExp.prototype.exec; | ||
var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y; | ||
var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG; | ||
if (PATCH) { | ||
// eslint-disable-next-line max-statements -- TODO | ||
patchedExec = function exec(str) { | ||
var re = this; | ||
var lastIndex, reCopy, match, i; | ||
var state = getInternalState(re); | ||
var raw = state.raw; | ||
var result, reCopy, lastIndex, match, i, object, group; | ||
if (raw) { | ||
raw.lastIndex = re.lastIndex; | ||
result = patchedExec.call(raw, str); | ||
re.lastIndex = raw.lastIndex; | ||
return result; | ||
} | ||
var groups = state.groups; | ||
var sticky = UNSUPPORTED_Y && re.sticky; | ||
@@ -84,2 +100,10 @@ var flags = regexpFlags.call(re); | ||
if (match && groups) { | ||
match.groups = object = create(null); | ||
for (i = 0; i < groups.length; i++) { | ||
group = groups[i]; | ||
object[group[0]] = match[group[1]]; | ||
} | ||
} | ||
return match; | ||
@@ -86,0 +110,0 @@ }; |
@@ -1,13 +0,9 @@ | ||
'use strict'; | ||
var fails = require('../internals/fails'); | ||
var fails = require('./fails'); | ||
// babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError, | ||
// so we use an intermediate function. | ||
function RE(s, f) { | ||
var RE = function (s, f) { | ||
return RegExp(s, f); | ||
} | ||
}; | ||
exports.UNSUPPORTED_Y = fails(function () { | ||
// babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError | ||
var re = RE('a', 'y'); | ||
@@ -14,0 +10,0 @@ re.lastIndex = 2; |
@@ -7,5 +7,5 @@ var IS_PURE = require('../internals/is-pure'); | ||
})('versions', []).push({ | ||
version: '3.14.0', | ||
version: '3.15.0', | ||
mode: IS_PURE ? 'pure' : 'global', | ||
copyright: '© 2021 Denis Pushkarev (zloirock.ru)' | ||
}); |
@@ -5,2 +5,3 @@ var DESCRIPTORS = require('../internals/descriptors'); | ||
var inheritIfRequired = require('../internals/inherit-if-required'); | ||
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); | ||
var defineProperty = require('../internals/object-define-property').f; | ||
@@ -13,5 +14,8 @@ var getOwnPropertyNames = require('../internals/object-get-own-property-names').f; | ||
var fails = require('../internals/fails'); | ||
var has = require('../internals/has'); | ||
var enforceInternalState = require('../internals/internal-state').enforce; | ||
var setSpecies = require('../internals/set-species'); | ||
var wellKnownSymbol = require('../internals/well-known-symbol'); | ||
var UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all'); | ||
var UNSUPPORTED_NCG = require('../internals/regexp-unsupported-ncg'); | ||
@@ -21,2 +25,4 @@ var MATCH = wellKnownSymbol('match'); | ||
var RegExpPrototype = NativeRegExp.prototype; | ||
// TODO: Use only propper RegExpIdentifierName | ||
var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/; | ||
var re1 = /a/g; | ||
@@ -30,11 +36,80 @@ var re2 = /a/g; | ||
var FORCED = DESCRIPTORS && isForced('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y || fails(function () { | ||
re2[MATCH] = false; | ||
// RegExp constructor can alter flags and IsRegExp works correct with @@match | ||
return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i'; | ||
}))); | ||
var BASE_FORCED = DESCRIPTORS && | ||
(!CORRECT_NEW || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG || fails(function () { | ||
re2[MATCH] = false; | ||
// RegExp constructor can alter flags and IsRegExp works correct with @@match | ||
return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i'; | ||
})); | ||
var handleDotAll = function (string) { | ||
var length = string.length; | ||
var index = 0; | ||
var result = ''; | ||
var brackets = false; | ||
var chr; | ||
for (; index <= length; index++) { | ||
chr = string.charAt(index); | ||
if (chr === '\\') { | ||
result += chr + string.charAt(++index); | ||
continue; | ||
} | ||
if (!brackets && chr === '.') { | ||
result += '[\\s\\S]'; | ||
} else { | ||
if (chr === '[') { | ||
brackets = true; | ||
} else if (chr === ']') { | ||
brackets = false; | ||
} result += chr; | ||
} | ||
} return result; | ||
}; | ||
var handleNCG = function (string) { | ||
var length = string.length; | ||
var index = 0; | ||
var result = ''; | ||
var named = []; | ||
var names = {}; | ||
var brackets = false; | ||
var ncg = false; | ||
var groupid = 0; | ||
var groupname = ''; | ||
var chr; | ||
for (; index <= length; index++) { | ||
chr = string.charAt(index); | ||
if (chr === '\\') { | ||
chr = chr + string.charAt(++index); | ||
} else if (chr === ']') { | ||
brackets = false; | ||
} else if (!brackets) switch (true) { | ||
case chr === '[': | ||
brackets = true; | ||
break; | ||
case chr === '(': | ||
if (IS_NCG.test(string.slice(index + 1))) { | ||
index += 2; | ||
ncg = true; | ||
} | ||
result += chr; | ||
groupid++; | ||
continue; | ||
case chr === '>' && ncg: | ||
if (groupname === '' || has(names, groupname)) { | ||
throw new SyntaxError('Invalid capture group name'); | ||
} | ||
names[groupname] = true; | ||
named.push([groupname, groupid]); | ||
ncg = false; | ||
groupname = ''; | ||
continue; | ||
} | ||
if (ncg) groupname += chr; | ||
else result += chr; | ||
} return [result, named]; | ||
}; | ||
// `RegExp` constructor | ||
// https://tc39.es/ecma262/#sec-regexp-constructor | ||
if (FORCED) { | ||
if (isForced('RegExp', BASE_FORCED)) { | ||
var RegExpWrapper = function RegExp(pattern, flags) { | ||
@@ -44,3 +119,4 @@ var thisIsRegExp = this instanceof RegExpWrapper; | ||
var flagsAreUndefined = flags === undefined; | ||
var sticky; | ||
var groups = []; | ||
var rawPattern, rawFlags, dotAll, sticky, handled, result, state; | ||
@@ -58,3 +134,14 @@ if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) { | ||
if (UNSUPPORTED_Y) { | ||
pattern = pattern === undefined ? '' : String(pattern); | ||
flags = flags === undefined ? '' : String(flags); | ||
rawPattern = pattern; | ||
if (UNSUPPORTED_DOT_ALL && 'dotAll' in re1) { | ||
dotAll = !!flags && flags.indexOf('s') > -1; | ||
if (dotAll) flags = flags.replace(/s/g, ''); | ||
} | ||
rawFlags = flags; | ||
if (UNSUPPORTED_Y && 'sticky' in re1) { | ||
sticky = !!flags && flags.indexOf('y') > -1; | ||
@@ -64,3 +151,9 @@ if (sticky) flags = flags.replace(/y/g, ''); | ||
var result = inheritIfRequired( | ||
if (UNSUPPORTED_NCG) { | ||
handled = handleNCG(pattern); | ||
pattern = handled[0]; | ||
groups = handled[1]; | ||
} | ||
result = inheritIfRequired( | ||
CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags), | ||
@@ -71,9 +164,20 @@ thisIsRegExp ? this : RegExpPrototype, | ||
if (UNSUPPORTED_Y && sticky) { | ||
var state = enforceInternalState(result); | ||
state.sticky = true; | ||
if (dotAll || sticky || groups.length) { | ||
state = enforceInternalState(result); | ||
if (dotAll) { | ||
state.dotAll = true; | ||
state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags); | ||
} | ||
if (sticky) state.sticky = true; | ||
if (groups.length) state.groups = groups; | ||
} | ||
if (pattern !== rawPattern) try { | ||
// fails in old engines, but we have no alternatives for unsupported regex syntax | ||
createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern); | ||
} catch (error) { /* empty */ } | ||
return result; | ||
}; | ||
var proxy = function (key) { | ||
@@ -86,5 +190,7 @@ key in RegExpWrapper || defineProperty(RegExpWrapper, key, { | ||
}; | ||
var keys = getOwnPropertyNames(NativeRegExp); | ||
var index = 0; | ||
while (keys.length > index) proxy(keys[index++]); | ||
for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index;) { | ||
proxy(keys[index++]); | ||
} | ||
RegExpPrototype.constructor = RegExpWrapper; | ||
@@ -91,0 +197,0 @@ RegExpWrapper.prototype = RegExpPrototype; |
var DESCRIPTORS = require('../internals/descriptors'); | ||
var objectDefinePropertyModule = require('../internals/object-define-property'); | ||
var regExpFlags = require('../internals/regexp-flags'); | ||
var UNSUPPORTED_Y = require('../internals/regexp-sticky-helpers').UNSUPPORTED_Y; | ||
var fails = require('../internals/fails'); | ||
var FORCED = DESCRIPTORS && fails(function () { | ||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe | ||
return Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call({ dotAll: true, sticky: true }) !== 'sy'; | ||
}); | ||
// `RegExp.prototype.flags` getter | ||
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags | ||
// eslint-disable-next-line es/no-regexp-prototype-flags -- required for testing | ||
if (DESCRIPTORS && (/./g.flags != 'g' || UNSUPPORTED_Y)) { | ||
objectDefinePropertyModule.f(RegExp.prototype, 'flags', { | ||
configurable: true, | ||
get: regExpFlags | ||
}); | ||
} | ||
if (FORCED) objectDefinePropertyModule.f(RegExp.prototype, 'flags', { | ||
configurable: true, | ||
get: regExpFlags | ||
}); |
@@ -10,3 +10,3 @@ var DESCRIPTORS = require('../internals/descriptors'); | ||
if (DESCRIPTORS && UNSUPPORTED_Y) { | ||
defineProperty(RegExp.prototype, 'sticky', { | ||
defineProperty(RegExpPrototype, 'sticky', { | ||
configurable: true, | ||
@@ -13,0 +13,0 @@ get: function () { |
@@ -10,3 +10,3 @@ 'use strict'; | ||
// @@match logic | ||
fixRegExpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) { | ||
fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) { | ||
return [ | ||
@@ -22,8 +22,8 @@ // `String.prototype.match` method | ||
// https://tc39.es/ecma262/#sec-regexp.prototype-@@match | ||
function (regexp) { | ||
var res = maybeCallNative(nativeMatch, regexp, this); | ||
function (string) { | ||
var res = maybeCallNative(nativeMatch, this, string); | ||
if (res.done) return res.value; | ||
var rx = anObject(regexp); | ||
var S = String(this); | ||
var rx = anObject(this); | ||
var S = String(string); | ||
@@ -30,0 +30,0 @@ if (!rx.global) return regExpExec(rx, S); |
'use strict'; | ||
var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic'); | ||
var fails = require('../internals/fails'); | ||
var anObject = require('../internals/an-object'); | ||
@@ -10,3 +11,5 @@ var toLength = require('../internals/to-length'); | ||
var regExpExec = require('../internals/regexp-exec-abstract'); | ||
var wellKnownSymbol = require('../internals/well-known-symbol'); | ||
var REPLACE = wellKnownSymbol('replace'); | ||
var max = Math.max; | ||
@@ -19,6 +22,29 @@ var min = Math.min; | ||
// IE <= 11 replaces $0 with the whole match, as if it was $& | ||
// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0 | ||
var REPLACE_KEEPS_$0 = (function () { | ||
// eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing | ||
return 'a'.replace(/./, '$0') === '$0'; | ||
})(); | ||
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string | ||
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () { | ||
if (/./[REPLACE]) { | ||
return /./[REPLACE]('a', '$0') === ''; | ||
} | ||
return false; | ||
})(); | ||
var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { | ||
var re = /./; | ||
re.exec = function () { | ||
var result = []; | ||
result.groups = { a: '7' }; | ||
return result; | ||
}; | ||
return ''.replace(re, '$<a>') !== '7'; | ||
}); | ||
// @@replace logic | ||
fixRegExpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) { | ||
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE; | ||
var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0; | ||
fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) { | ||
var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0'; | ||
@@ -38,13 +64,14 @@ | ||
// https://tc39.es/ecma262/#sec-regexp.prototype-@@replace | ||
function (regexp, replaceValue) { | ||
function (string, replaceValue) { | ||
if ( | ||
(!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) || | ||
(typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1) | ||
typeof replaceValue === 'string' && | ||
replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1 && | ||
replaceValue.indexOf('$<') === -1 | ||
) { | ||
var res = maybeCallNative(nativeReplace, regexp, this, replaceValue); | ||
var res = maybeCallNative(nativeReplace, this, string, replaceValue); | ||
if (res.done) return res.value; | ||
} | ||
var rx = anObject(regexp); | ||
var S = String(this); | ||
var rx = anObject(this); | ||
var S = String(string); | ||
@@ -101,2 +128,2 @@ var functionalReplace = typeof replaceValue === 'function'; | ||
]; | ||
}); | ||
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE); |
@@ -9,3 +9,3 @@ 'use strict'; | ||
// @@search logic | ||
fixRegExpWellKnownSymbolLogic('search', 1, function (SEARCH, nativeSearch, maybeCallNative) { | ||
fixRegExpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCallNative) { | ||
return [ | ||
@@ -21,8 +21,8 @@ // `String.prototype.search` method | ||
// https://tc39.es/ecma262/#sec-regexp.prototype-@@search | ||
function (regexp) { | ||
var res = maybeCallNative(nativeSearch, regexp, this); | ||
function (string) { | ||
var res = maybeCallNative(nativeSearch, this, string); | ||
if (res.done) return res.value; | ||
var rx = anObject(regexp); | ||
var S = String(this); | ||
var rx = anObject(this); | ||
var S = String(string); | ||
@@ -29,0 +29,0 @@ var previousLastIndex = rx.lastIndex; |
@@ -12,2 +12,3 @@ 'use strict'; | ||
var stickyHelpers = require('../internals/regexp-sticky-helpers'); | ||
var fails = require('../internals/fails'); | ||
@@ -19,4 +20,15 @@ var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y; | ||
// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec | ||
// Weex JS has frozen built-in prototypes, so use try / catch wrapper | ||
var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () { | ||
// eslint-disable-next-line regexp/no-empty-group -- required for testing | ||
var re = /(?:)/; | ||
var originalExec = re.exec; | ||
re.exec = function () { return originalExec.apply(this, arguments); }; | ||
var result = 'ab'.split(re); | ||
return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b'; | ||
}); | ||
// @@split logic | ||
fixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) { | ||
fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) { | ||
var internalSplit; | ||
@@ -90,8 +102,8 @@ if ( | ||
// the 'y' flag. | ||
function (regexp, limit) { | ||
var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit); | ||
function (string, limit) { | ||
var res = maybeCallNative(internalSplit, this, string, limit, internalSplit !== nativeSplit); | ||
if (res.done) return res.value; | ||
var rx = anObject(regexp); | ||
var S = String(this); | ||
var rx = anObject(this); | ||
var S = String(string); | ||
var C = speciesConstructor(rx, RegExp); | ||
@@ -137,2 +149,2 @@ | ||
]; | ||
}, UNSUPPORTED_Y); | ||
}, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y); |
@@ -37,3 +37,3 @@ 'use strict'; | ||
var DIGIT = /\d/; | ||
var HEX_START = /^(0x|0X)/; | ||
var HEX_START = /^0x/i; | ||
var OCT = /^[0-7]+$/; | ||
@@ -43,4 +43,4 @@ var DEC = /^\d+$/; | ||
/* eslint-disable no-control-regex -- safe */ | ||
var FORBIDDEN_HOST_CODE_POINT = /[\0\t\n\r #%/:?@[\\]]/; | ||
var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\0\t\n\r #/:?@[\\]]/; | ||
var FORBIDDEN_HOST_CODE_POINT = /[\0\t\n\r #%/:<>?@[\\\]^|]/; | ||
var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\0\t\n\r #/:<>?@[\\\]^|]/; | ||
var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g; | ||
@@ -47,0 +47,0 @@ var TAB_AND_NEW_LINE = /[\t\n\r]/g; |
{ | ||
"name": "core-js", | ||
"description": "Standard library", | ||
"version": "3.14.0", | ||
"version": "3.15.0", | ||
"repository": { | ||
@@ -58,3 +58,3 @@ "type": "git", | ||
}, | ||
"gitHead": "e386f3de7760ee2910d07efb9d35029aa5dda93b" | ||
"gitHead": "4f7f304e7472127efc4749323c56819312fb327f" | ||
} |
@@ -50,3 +50,6 @@ require('../modules/es.symbol'); | ||
require('../modules/es.data-view'); | ||
require('../modules/es.date.get-year'); | ||
require('../modules/es.date.now'); | ||
require('../modules/es.date.set-year'); | ||
require('../modules/es.date.to-gmt-string'); | ||
require('../modules/es.date.to-iso-string'); | ||
@@ -56,2 +59,3 @@ require('../modules/es.date.to-json'); | ||
require('../modules/es.date.to-string'); | ||
require('../modules/es.escape'); | ||
require('../modules/es.function.bind'); | ||
@@ -140,2 +144,3 @@ require('../modules/es.function.has-instance'); | ||
require('../modules/es.regexp.constructor'); | ||
require('../modules/es.regexp.dot-all'); | ||
require('../modules/es.regexp.exec'); | ||
@@ -163,2 +168,3 @@ require('../modules/es.regexp.flags'); | ||
require('../modules/es.string.starts-with'); | ||
require('../modules/es.string.substr'); | ||
require('../modules/es.string.trim'); | ||
@@ -214,2 +220,3 @@ require('../modules/es.string.trim-end'); | ||
require('../modules/es.typed-array.to-string'); | ||
require('../modules/es.unescape'); | ||
require('../modules/es.weak-map'); | ||
@@ -216,0 +223,0 @@ require('../modules/es.weak-set'); |
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
741650
1817
17763