Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ Validator | Description
**isVAT(str, countryCode)** | checks that the string is a [valid VAT number](https://en.wikipedia.org/wiki/VAT_identification_number) if validation is available for the given country code matching [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). <br/><br/>Available country codes: `[ 'GB', 'IT','NL' ]`.
**isWhitelisted(str, chars)** | checks characters if they appear in the whitelist.
**matches(str, pattern [, modifiers])** | check if string matches the pattern.<br/><br/>Either `matches('foo', /foo/i)` or `matches('foo', 'foo', 'i')`.
**isEmoji(str)** | check if the string is emoji character.

## Sanitizers

Expand Down
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ import isStrongPassword from './lib/isStrongPassword';

import isVAT from './lib/isVAT';

import isEmoji from './lib/isEmoji';

const version = '13.7.0';

const validator = {
Expand Down Expand Up @@ -226,6 +228,7 @@ const validator = {
isDate,
isLicensePlate,
isVAT,
isEmoji,
ibanLocales,
};

Expand Down
9 changes: 9 additions & 0 deletions src/lib/isEmoji.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -11982,4 +11982,21 @@ describe('Validators', () => {
],
});
});
it('should validate emoji character', () => {
test({
validator: 'isEmoji',
valid: [
'🥺',
'🥰',
'🫡',
],
invalid: [
'HAPPY',
'TEXT',
'1',
'2',
'🫡🫡',
],
});
});
});