Skip to content

Commit

Permalink
some stylistic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Jun 20, 2021
1 parent dded201 commit 9a91e18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var createNonEnumerableProperty = require('../internals/create-non-enumerable-pr
var SPECIES = wellKnownSymbol('species');
var RegExpPrototype = RegExp.prototype;

module.exports = function (KEY, exec, FORCED, sham) {
module.exports = function (KEY, exec, FORCED, SHAM) {
var SYMBOL = wellKnownSymbol(KEY);

var DELEGATES_TO_SYMBOL = !fails(function () {
Expand Down Expand Up @@ -68,5 +68,5 @@ module.exports = function (KEY, exec, FORCED, sham) {
redefine(RegExpPrototype, SYMBOL, methods[1]);
}

if (sham) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/regexp-sticky-helpers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var fails = require('./fails');

// babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
var RE = function RE(s, f) {
var RE = function (s, f) {
return RegExp(s, f);
};

Expand Down
4 changes: 2 additions & 2 deletions tests/tests/es.regexp.constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ if (DESCRIPTORS) {
});

QUnit.test('RegExp NCG', assert => {
assert.same(RegExp('(?<a>b)', (typeof '').charAt(5)).exec('b').groups?.a, 'b', 'NCG #1');
assert.same(RegExp('(?<a>b)').exec('b').groups?.a, 'b', 'NCG #1');
// eslint-disable-next-line regexp/no-unused-capturing-group -- required for testing
assert.same(RegExp('(b)', (typeof '').charAt(5)).exec('b').groups, undefined, 'NCG #2');
assert.same(RegExp('(b)').exec('b').groups, undefined, 'NCG #2');
assert.same('foo:abc,bar:def'.replace(RegExp('foo:(?<foo>\\w+),bar:(?<bar>\\w+)'), '$<bar>,$<foo>'), 'def,abc', 'replace #1');
assert.same('foo:abc,bar:def'.replace(RegExp('foo:(?<foo>\\w+),bar:(?<bar>\\w+)'), (...args) => {
const { foo, bar } = args.pop();
Expand Down

0 comments on commit 9a91e18

Please sign in to comment.