@crispengari/regex-validator
v1.0.3
Published
This is a simple npm/yarn package that validate strings
Downloads
40
Maintainers
Readme
Regex Valiador.
This is a package that validate basic strings using regular expressions. This package is used to validate strings like passwords, username, phone-numbers or and email.
Installation
yarn
yarn add @crispengari/regex-validator
npm
npm install @crispengari/regex-validator
TypeScript
You don't have to explicitly install the types for this package because it was created using typescript.
Basic usage
import {
isValidEmail,
isValidUsername,
isValidPhoneNumber,
isValidPassword,
} from "@crispen/regex-validator";
console.log(isValidEmail("[email protected]")); // true
console.log(isValidUsername("username_9")); // true
console.log(isValidPhoneNumber("+98 778 901 7890")); // true
console.log(isValidPassword("this_is9t@")); // true
Password salts
.
We have some 3 basic password salts
that we can validate which are:
Changing the password salt
to validate.
You can change the password salt easily by passing the following the salt as the second argument to the ``:
import { isValidPassword } from "@crispen/regex-validator";
console.log(isValidPassword("this_is9t@", passwordSalts.M8L1D1));