Skip to content

Commit 2e87d77

Browse files
committed
tweak String#split setting
1 parent 299f9cd commit 2e87d77

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

packages/core-js/modules/es.string.split.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
3131
return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
3232
});
3333

34+
var BUGGY = 'abbc'.split(/(b)*/)[1] === 'c' ||
35+
// eslint-disable-next-line regexp/no-empty-group -- required for testing
36+
'test'.split(/(?:)/, -1).length !== 4 ||
37+
'ab'.split(/(?:ab)*/).length !== 2 ||
38+
'.'.split(/(.?)(.?)/).length !== 4 ||
39+
// eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
40+
'.'.split(/()()/).length > 1 ||
41+
''.split(/.?/).length;
42+
3443
// @@split logic
3544
fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) {
36-
var BUGGY = 'abbc'.split(/(b)*/)[1] === 'c' ||
37-
// eslint-disable-next-line regexp/no-empty-group -- required for testing
38-
'test'.split(/(?:)/, -1).length !== 4 ||
39-
'ab'.split(/(?:ab)*/).length !== 2 ||
40-
'.'.split(/(.?)(.?)/).length !== 4 ||
41-
// eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
42-
'.'.split(/()()/).length > 1 ||
43-
''.split(/.?/).length;
44-
4545
var internalSplit = '0'.split(undefined, 0).length ? function (separator, limit) {
4646
return separator === undefined && limit === 0 ? [] : call(nativeSplit, this, separator, limit);
4747
} : nativeSplit;
@@ -108,4 +108,4 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa
108108
return A;
109109
}
110110
];
111-
}, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
111+
}, BUGGY || !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);

0 commit comments

Comments
 (0)