diff --git a/README.md b/README.md
index 8977228c8..cc839dcee 100644
--- a/README.md
+++ b/README.md
@@ -110,6 +110,7 @@ Validator | Description
**isDecimal(str [, options])** | check if the string represents a decimal number, such as 0.1, .3, 1.1, 1.00003, 4.0, etc.
`options` is an object which defaults to `{force_decimal: false, decimal_digits: '1,', locale: 'en-US'}`
`locale` determine the decimal separator and is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fa', 'fa-AF', 'fa-IR', 'fr-FR', 'fr-CA', 'hu-HU', 'id-ID', 'it-IT', 'ku-IQ', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pl-Pl', 'pt-BR', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN']`.
**Note:** `decimal_digits` is given as a range like '1,3', a specific value like '3' or min like '1,'.
**isDivisibleBy(str, number)** | check if the string is a number that's divisible by another.
**isEAN(str)** | check if the string is an EAN (European Article Number).
+**isEmoji(str)** | check if the string is contains an Emoji.
**isEmail(str [, options])** | check if the string is an email.
`options` is an object which defaults to `{ allow_display_name: false, require_display_name: false, allow_utf8_local_part: true, require_tld: true, allow_ip_domain: false, domain_specific_validation: false, blacklisted_chars: '', host_blacklist: [] }`. If `allow_display_name` is set to true, the validator will also match `Display Name `. If `require_display_name` is set to true, the validator will reject strings without the format `Display Name `. If `allow_utf8_local_part` is set to false, the validator will not allow any non-English UTF8 character in email address' local part. If `require_tld` is set to false, e-mail addresses without having TLD in their domain will also be matched. If `ignore_max_length` is set to true, the validator will not check for the standard max length of an email. If `allow_ip_domain` is set to true, the validator will allow IP addresses in the host part. If `domain_specific_validation` is true, some additional validation will be enabled, e.g. disallowing certain syntactically valid email addresses that are rejected by GMail. If `blacklisted_chars` receives a string, then the validator will reject emails that include any of the characters in the string, in the name part. If `host_blacklist` is set to an array of strings and the part of the email after the `@` symbol matches one of the strings defined in it, the validation fails.
**isEmpty(str [, options])** | check if the string has a length of zero.
`options` is an object which defaults to `{ ignore_whitespace:false }`.
**isEthereumAddress(str)** | check if the string is an [Ethereum](https://ethereum.org/) address using basic regex. Does not validate address checksums.
diff --git a/src/index.js b/src/index.js
index 42e1e8b69..cf90189d2 100644
--- a/src/index.js
+++ b/src/index.js
@@ -28,6 +28,7 @@ import isUppercase from './lib/isUppercase';
import isIMEI from './lib/isIMEI';
import isAscii from './lib/isAscii';
+import isEmoji from './lib/isEmoji';
import isFullWidth from './lib/isFullWidth';
import isHalfWidth from './lib/isHalfWidth';
import isVariableWidth from './lib/isVariableWidth';
@@ -153,6 +154,7 @@ const validator = {
isLowercase,
isUppercase,
isAscii,
+ isEmoji,
isFullWidth,
isHalfWidth,
isVariableWidth,
diff --git a/src/lib/isEmoji.js b/src/lib/isEmoji.js
new file mode 100644
index 000000000..4fa832c1c
--- /dev/null
+++ b/src/lib/isEmoji.js
@@ -0,0 +1,9 @@
+import assertString from './util/assertString';
+
+const emojis = /\p{Emoji_Presentation}/u;
+const emojiRegex = /[\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}\u{203c}\u{2047}-\u{204A}\u{2195}-\u{2199}]/u;
+export default function isEmoji(str) {
+ assertString(str);
+
+ return emojis.test(str) || emojiRegex.test(str);
+}
diff --git a/test/validators.js b/test/validators.js
index 87f73ccd4..c98e36523 100644
--- a/test/validators.js
+++ b/test/validators.js
@@ -5738,6 +5738,77 @@ describe('Validators', () => {
});
});
+ it('should validate a string that contains an emoji', () => {
+ test({
+ validator: 'isEmoji',
+ valid: [
+ '๐',
+ '๐ฎ',
+ '๐ฑ',
+ 'horse ๐ด',
+ '๐ด๐คญ',
+ 'lots of emojis !! ๐ถโ๐ซ๏ธ๐บ๐ค TEST',
+ '๐งก',
+ '๐ด',
+ '๐๐ป',
+ '๐',
+ 'โ',
+ '๐',
+ 'โ',
+ 'ยฎ',
+ 'โ',
+ '๐',
+ '๐',
+ '๐',
+ 'โช',
+ 'โ',
+ 'โ',
+ 'โฆ',
+ 'โ',
+ 'โก',
+ 'โญ',
+ 'โ',
+ 'โ',
+ '๐ท',
+ 'โ',
+ 'โฉ',
+ 'โ',
+ 'โ',
+ 'โฃ',
+ 'โ ',
+ 'โ',
+ 'โ',
+ 'โญ',
+ 'ยฉ',
+ 'โผ',
+ 'โ',
+ 'โ',
+ 'โพ',
+ 'โฏ',
+ 'โก',
+ 'โ',
+ 'โถ',
+ 'โน',
+ 'โ',
+ 'โช',
+ 'โก',
+ 'โธ',
+ 'โ',
+ 'โ',
+ 'โบ smile',
+ 'โค',
+ 'โค heart symbol!',
+ ],
+ invalid: [
+ 'abc',
+ 'abc123',
+ '!"#$%&()<>/+=-_? ~^|.,@`{}[]',
+ 'ใใใใใ',
+ 'ไฝ ๅฅฝ',
+ ],
+ });
+ });
+
it('should validate full-width strings', () => {
test({
validator: 'isFullWidth',