jdecked / twemoji-parser

A simple library for identifying emoji entities within a string in order to render them as Twemoji.
MIT License
16 stars 6 forks source link

Feature request: Export the regex #6

Open RedGuy12 opened 4 months ago

RedGuy12 commented 4 months ago

Could the regular expression used internally to match Twemoji be exported? I think it could be very useful to find supported Unicode emojis within a string. Over 85% of this package's source code is the regex, and it's not even directly usable, which just seems a bit odd to me. It's really the most important part of the whole package.

You can currently import it directly with the full path (import twemojiRegexp from "@twemoji/parser/dist/lib/regex.js";), but it'd be preferable if it was explicitly exported.

jdecked commented 3 months ago

Could you tell me a bit more about your use case @RedGuy12? Is there some reason you're against using the parse function exported by the package to use the regex?