@@ -26,15 +26,14 @@ function addCharacterClassEscape(lower, set) {
26
26
ESCAPE_CHARS [ lower ] = ESCAPE_CHARS_UNICODE [ lower ] = set ;
27
27
const upper = lower . toUpperCase ( ) ;
28
28
ESCAPE_CHARS [ upper ] = BMP_SET . clone ( ) . remove ( set ) ;
29
- const uExcludeSet = UNICODE_SET . clone ( ) . remove ( set ) ;
30
- ESCAPE_CHARS_UNICODE [ upper ] = uExcludeSet ;
29
+ ESCAPE_CHARS_UNICODE [ upper ] = UNICODE_SET . clone ( ) . remove ( set ) ;
31
30
// Check if one or more symbols in this set fold to another one. If so,
32
31
// a copy of the set including the mapped symbols is created for use with
33
32
// regular expressions that have both the `u` and `i` flags set.
34
33
const codePoints = set . toArray ( ) ;
35
34
const iuSet = regenerate ( ) ;
36
35
let containsFoldingSymbols = false ;
37
- codePoints . forEach ( function ( codePoint ) {
36
+ for ( const codePoint of codePoints ) {
38
37
let folded = caseFold ( codePoint ) ;
39
38
if ( folded ) {
40
39
containsFoldingSymbols = true ;
@@ -44,13 +43,13 @@ function addCharacterClassEscape(lower, set) {
44
43
iuSet . add ( folded ) ;
45
44
}
46
45
}
47
- } ) ;
48
- ESCAPE_CHARS_UNICODE_IGNORE_CASE [ lower ] = containsFoldingSymbols ?
46
+ }
47
+ const iuLowerSet = containsFoldingSymbols ?
49
48
iuSet . clone ( ) . add ( set ) :
50
49
set ;
51
- ESCAPE_CHARS_UNICODE_IGNORE_CASE [ upper ] = containsFoldingSymbols ?
52
- iuSet . clone ( ) . add ( uExcludeSet ) :
53
- uExcludeSet ;
50
+ const iuUpperSet = UNICODE_SET . clone ( ) . remove ( iuLowerSet ) ;
51
+ ESCAPE_CHARS_UNICODE_IGNORE_CASE [ lower ] = iuLowerSet ;
52
+ ESCAPE_CHARS_UNICODE_IGNORE_CASE [ upper ] = iuUpperSet ;
54
53
}
55
54
56
55
// Prepare a Regenerate set for every existing character class escape.
0 commit comments