Skip to content

Commit

Permalink
some #537-related fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed May 10, 2019
1 parent 4548330 commit b68f408
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 3 additions & 2 deletions packages/core-js/modules/es.regexp.to-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ var INCORRECT_NAME = nativeToString.name != TO_STRING;
if (NOT_GENERIC || INCORRECT_NAME) {
require('../internals/redefine')(RegExp.prototype, TO_STRING, function toString() {
var R = anObject(this);
var p = String(R.source);
var rf = R.flags;
return '/'.concat(R.source, '/',
rf == null && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf);
var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf);
return '/' + p + '/' + f;
}, { unsafe: true });
}
5 changes: 0 additions & 5 deletions tests/tests/es.regexp.to-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ QUnit.test('RegExp#toString', assert => {
flags: 'bar',
}), '/foo/bar');
assert.same(toString.call({}), '/undefined/undefined');
assert.same(toString.call(new Proxy(/pattern/, {
get(object, key) {
return key === 'flags' ? 'x' : object[key];
},
})), '/pattern/x');
if (STRICT) {
assert.throws(() => toString.call(7));
assert.throws(() => toString.call('a'));
Expand Down

0 comments on commit b68f408

Please sign in to comment.