unicode-segmenter/emoji and unicode-segmenter/general only work for a single codepoint, and they're not actually about Unicode segmentation.
Technically speaking, the unicode-segmenter library provides a practical way to determine whether a codepoint is Extended_Pictographic or not, but it cannot determine whether it matches the definition of a Unicode Emoji exactly.
Most browsers support the Unicode sets feature for matching by Unicode properties. And specifically for emoji, most are not a single code point.
It requires /\p{RGI_Emoji}/v, or if not supported, another library like rgi-emoji-regex-pattern.
Like other Unicode features, some embedded runtimes might not support Unicode sets, so libraries are still helpful, but there's no reason for it to be part of unicode-segmenter library.
I plan to create a separate library that matches Unicode properties and migrate the functionality of unicode-segmenter/emoji and unicode-segmenter/general into it.
unicode-segmenter/emojiandunicode-segmenter/generalonly work for a single codepoint, and they're not actually about Unicode segmentation.Technically speaking, the unicode-segmenter library provides a practical way to determine whether a codepoint is
Extended_Pictographicor not, but it cannot determine whether it matches the definition of a Unicode Emoji exactly.Most browsers support the Unicode sets feature for matching by Unicode properties. And specifically for emoji, most are not a single code point.
It requires
/\p{RGI_Emoji}/v, or if not supported, another library like rgi-emoji-regex-pattern.Like other Unicode features, some embedded runtimes might not support Unicode sets, so libraries are still helpful, but there's no reason for it to be part of unicode-segmenter library.
I plan to create a separate library that matches Unicode properties and migrate the functionality of
unicode-segmenter/emojiandunicode-segmenter/generalinto it.