Install the library with npm install validity-checker
var validityChecker = require('validity-checker');var result = validityChecker.isEmail("[email protected]");returns true or false
var result = validityChecker.isMobileNumber("9999999999");returns true or false
var result = validityChecker(isBetweenDoubleQuotes('Hello.. "Everybody"',"Everybody"));
/* returns true
checks according to the case sensitivity
*/var result = validityChecker(isEmoji("🙃🙃"));
/* returns true */- (123) 456-7890
- (123)456-7890
- 123-456-7890
- 123.456.7890
- 1234567890
- +31636363634
- 075-63546725
Some other other validity-checkers are:
| validity-checkers | Description |
|---|---|
| isVisaCard() | Returns true if the string is in the visa card format |
| isMasterCard() | Returns true if the string is in the master card format |
| isAmericanExpressCard() | Returns true if the string is in the american express card format |
| isDinersClubCard() | Returns true if the string is in the Diners Club card format |
| isDiscoverCard() | Returns true if the string is in the Discover Card format |
| isJCBCard() | Returns true if the string is in the JCB Card format |
| isCardNumber() | Returns true if the string is in any of the above card formats |
| isStrongPassword() | Returns true if the password is strong |
| isMediumStrengthPassword() | Returns true if the password is neither too strong nor too weak |
| isPortNumber() | Returns true if the string is valid Port number (except 0) |
| isMacAddress() | Returns true if the string is a valid MAC Address |
| isValidUrl() | Returns true if the string is a valid url (including ftp, https, smtp) |
| isHexColorCode() | Returns true if the string is a valid hex color code |
| isInternationalPassportNumber() | Returns true if the string is a valid international passport number |
| isIMEINumber() | Returns true if the number is a valid IMEI number |
| isUUIDv4() | Returns true if the entered string is uuid v4 |
| isUSSD() | Returns true if the entered string is a valid USSD Code |
| isBrainFuckCode() | Returns true if the entered string is a valid BrainFuck code |
| isMorseCode() | Returns true if the entered string is a valid Morse Code or not |
| isIPV4() | Returns true if the entered string is a valid IPv4 |
| isIPV6() | Returns true if the entered string is a valid IPv4 |
| isBetweenDoubleQuotes() | Returns true if the entered string is contained in between double quotes |
| isEmoji() | Returns true if the entered string is an Emoji |
The above mentioned functions validating only the format of the card numbers not the real card numbers.