mirror of
https://github.com/hanzoai/core-js.git
synced 2026-09-24 16:58:15 +00:00
fix String.prototype.{ match, search } polyfills conversion order
This commit is contained in:
@@ -22,7 +22,9 @@ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa
|
||||
function match(regexp) {
|
||||
var O = requireObjectCoercible(this);
|
||||
var matcher = isObject(regexp) ? getMethod(regexp, MATCH) : undefined;
|
||||
return matcher ? call(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString(O));
|
||||
if (matcher) return call(matcher, regexp, O);
|
||||
var S = toString(O);
|
||||
return new RegExp(regexp)[MATCH](S);
|
||||
},
|
||||
// `RegExp.prototype[@@match]` method
|
||||
// https://tc39.es/ecma262/#sec-regexp.prototype-@@match
|
||||
|
||||
@@ -17,7 +17,9 @@ fixRegExpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCal
|
||||
function search(regexp) {
|
||||
var O = requireObjectCoercible(this);
|
||||
var searcher = isObject(regexp) ? getMethod(regexp, SEARCH) : undefined;
|
||||
return searcher ? call(searcher, regexp, O) : new RegExp(regexp)[SEARCH](toString(O));
|
||||
if (searcher) return call(searcher, regexp, O);
|
||||
var S = toString(O);
|
||||
return new RegExp(regexp)[SEARCH](S);
|
||||
},
|
||||
// `RegExp.prototype[@@search]` method
|
||||
// https://tc39.es/ecma262/#sec-regexp.prototype-@@search
|
||||
|
||||
Reference in New Issue
Block a user