1041
}
1042
}
1044
>
// Do not break before extending characters or ZWJ.
1045
>
// GB9 × (Extend | ZWJ)
1046
if (breakTypeB === GraphemeBreakType.Extend || breakTypeB === GraphemeBreakType.ZWJ) {
1047
return false; // GB9
1048
}
1050
>
// The GB9a and GB9b rules only apply to extended grapheme clusters:
1051
>
// Do not break before SpacingMarks, or after Prepend characters.
1052
>
// GB9a × SpacingMark
1053
>
// GB9b Prepend ×
1054
>
if (breakTypeB === GraphemeBreakType.SpacingMark) {
1055
return false; // GB9a
1056
}
1057
>
if (breakTypeA === GraphemeBreakType.Prepend) {
strings.ts
1058
return false; // GB9b
1059
}
1061
>
// Do not break within emoji modifier sequences or emoji zwj sequences.
1062
>
// GB11 \p{Extended_Pictographic} Extend* ZWJ × \p{Extended_Pictographic}
1063
if (breakTypeA === GraphemeBreakType.ZWJ && breakTypeB === GraphemeBreakType.Extended_Pictographic) {
1064
// Note: we are not implementing the rule entirely here to avoid introducing states
1065
return false; // GB11
1066
}
1068
>
// GB12 sot (RI RI)* RI × RI
1069
>
// GB13 [^RI] (RI RI)* RI × RI
1070
if (breakTypeA === GraphemeBreakType.Regional_Indicator && breakTypeB === GraphemeBreakType.Regional_Indicator) {
1071
// Note: we are not implementing the rule entirely here to avoid introducing states
1072
return false; // GB12 & GB13
1073
}
1075
>
// GB999 Any ÷ Any
1076
>
return true;
1077
>
}
1078
1079
export const enum GraphemeBreakType {