Explains sort/reverse of emoji replacements

This commit is contained in:
Joffrey JAFFEUX 2017-06-14 17:54:52 +02:00
parent 93778500c3
commit 353d059133
1 changed files with 1 additions and 0 deletions

View File

@ -7,6 +7,7 @@ let _unicodeRegexp;
export function setUnicodeReplacements(replacements) {
_unicodeReplacements = replacements;
if (replacements) {
// We sort and reverse to match longer emoji sequences first
_unicodeRegexp = new RegExp(Object.keys(replacements).sort().reverse().join("|"), "g");
}
};