File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,15 @@ export const EMOTICON_TO_EMOJI = new Map<string, IEmoji>();
35
35
36
36
export const getEmojiFromUnicode = unicode => UNICODE_TO_EMOJI . get ( stripVariation ( unicode ) ) ;
37
37
38
- const isRegionalIndicator = ( x : string ) : boolean =>
39
- Array . from ( x ) . length === 1 && x >= '\u{1f1e6}' && x <= '\u{1f1ff}' ;
38
+ const isRegionalIndicator = ( x : string ) : boolean => {
39
+ // First verify that the string is a single character. We use Array.from
40
+ // to make sure we count by characters, not UTF-8 code units.
41
+ return Array . from ( x ) . length === 1 &&
42
+ // Next verify that the character is within the code point range for
43
+ // regional indicators.
44
+ // http://unicode.org/charts/PDF/Unicode-6.0/U60-1F100.pdf
45
+ x >= '\u{1f1e6}' && x <= '\u{1f1ff}' ;
46
+ } ;
40
47
41
48
const EMOJIBASE_GROUP_ID_TO_CATEGORY = [
42
49
"people" , // smileys
You can’t perform that action at this time.
0 commit comments