This commit is contained in:
DianaXWiki 2024-09-04 14:47:07 +03:00
parent d167c703fc
commit b780a8eab9
1 changed files with 2 additions and 2 deletions

View File

@ -123,8 +123,8 @@ define([
if (!seed) { return; } if (!seed) { return; }
return ANIMALS[seed % ANIMALS.length] || ''; return ANIMALS[seed % ANIMALS.length] || '';
}; };
//this regex identifies both discord and unicode emojis (with optional skin tone modifiers) and some zwj composite emojis //this regex identifies both discord and unicode emojis (with optional skin tone modifiers) and complex zwj emoji sequences
const emojiWithZWJRegex = /<a?:.+?:\d{18}>|(?:\p{Extended_Pictographic}\p{Emoji_Modifier}?)(?:\u200D(?:\p{Extended_Pictographic}\p{Emoji_Modifier}?))*/gu; const emojiWithZWJRegex = /(?:\p{Extended_Pictographic}(?:\p{Emoji_Modifier}|\uFE0F)?(?:\u200D\p{Extended_Pictographic}(?:\p{Emoji_Modifier}|\uFE0F)?)*|\p{Extended_Pictographic})/gu;
var getPrettyInitials = MT.getPrettyInitials = function (name) { var getPrettyInitials = MT.getPrettyInitials = function (name) {
let matches = name.match(emojiWithZWJRegex); let matches = name.match(emojiWithZWJRegex);
if (matches && name.startsWith(matches[0])) { if (matches && name.startsWith(matches[0])) {