Techmmunity Easy-Check is a library to check ALL the things that a lot of projects need to check, like email, username, phone and many, many more validations.
With Yarn:
yarn add @techmmunity/easy-check
With NPM:
npm i @techmmunity/easy-check
The most easy way to upgrade, is just changing the import.
2.x:
import { check } from "@techmmunity/easy-check";
3.x:
import * as check from "@techmmunity/easy-check";
With TypeScript:
import { isEmail } from "@techmmunity/easy-check";
if (isEmail("[email protected]")) {
console.log("Yes, it's an email!");
}
or
import * as check from "@techmmunity/easy-check";
if (check.isEmail("[email protected]")) {
console.log("Yes, it's an email!");
}
With JavaScript:
const { isEmail } = require("@techmmunity/easy-check");
if (isEmail("[email protected]")) {
console.log("Yes, it's an email!");
}
All the details about contributing to the project are described here.
You can find more information about the methods in the comments of the methods declaration.
Method | How To Use |
---|---|
isCPF |
isCPF("55357314047") |
isMaskedCPF |
isMaskedCPF("553.573.140-47") |
isDateDMY |
isDateDMY("31-01-2020") |
isDateDMYS |
isDateDMYS("31/01/2020") |
isDateMDY |
isDateMDY("01-31-2020") |
isDateMDYS |
isDateMDYS("01/31/2020") |
isDateYMD |
isDateYMD("2020-01-31") |
isDateYMDS |
isDateYMDS("2020/01/31") |
isLeap |
isLeap("2020") |
isEmail |
isEmail("[email protected]") |
isEmoji |
isEmoji("😂") |
hasEmojis |
hasEmojis("Yes, there is emojis here 😂") |
isHerokuApiKey |
isHerokuApiKey("625628d3-8a45-466e-a55e-ead5c6886887") |
isHexColor |
isHexColor("#000") |
hasHtmlTags |
hasHtmlTags("Foo <b>Bar</b>") |
isIpv4 |
isIpv4("192.168.1.1") |
isIpv4WithMask |
isIpv4WithMask("192.168.1.1/24") |
isStrongPassword |
isStrongPassword("$t0ngP@ssw0rD") |
isBrazillianPhone |
isBrazillianPhone("2199999999") |
isUrl |
isUrl("https://google.com") |
hasUrl |
hasUrl("foo bar https://google.com foo bar") |
isSimpleUsername |
isSimpleUsername("user-name") |
isUUIDv4 |
isUUIDv4("24bd85a1-4eb7-4f63-829e-75c08ac2b6c0") |
Method | How To Use |
---|---|
isEven |
isEven(2) |
isOdd |
isOdd(1) |