You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to contribute emoji validation to validator.js. Before starting implementation, I'd like to clarify the intended API and the definition of an emoji.
Between 2021-2022, there were lots of discussions and PRs about adding an isEmoji function to this project, but it seems that they are abandoned. So, I'd like to suggest closing them and starting fresh with this issue.
In those issues and PRs, two main questions came up.
Name and behavior of the emoji validator.
If the name is isEmoji, should it only determine if single character is emoji or not?
If the name is hasEmoji or containsEmoji, should it determine if the given string contains an emoji in it or not?
Which Unicode characters and sequences should count as emojis?
Suggestion
I'd like to implement two validators.
isEmoji
This validator checks whether the given string is exactly one complete emoji.
This validator checks whether the given string contains at least one emoji in it.
Example
validator.hasEmoji("nice to meet you.");// false (no emoji)validator.hasEmoji("hello, world! 🎉");// truevalidator.hasEmoji("😃😆🥰");// truevalidator.hasEmoji("✅");// true
Emoji definition
I propose using Unicode's RGI (Recommended for General Interchange) emoji set, with the supported Unicode version documented. https://unicode.org/reports/tr51/
Activity