Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/crispengari/regex-validator
this is a javascript package that validate the validity of common strings. It check if the basic strings like email, password, username are valid.
https://github.com/crispengari/regex-validator
javascript regular-expression typescript validations validator
Last synced: about 2 months ago
JSON representation
this is a javascript package that validate the validity of common strings. It check if the basic strings like email, password, username are valid.
- Host: GitHub
- URL: https://github.com/crispengari/regex-validator
- Owner: CrispenGari
- License: apache-2.0
- Created: 2021-08-21T18:16:33.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-27T07:21:38.000Z (almost 2 years ago)
- Last Synced: 2024-11-18T11:25:03.189Z (3 months ago)
- Topics: javascript, regular-expression, typescript, validations, validator
- Language: TypeScript
- Homepage:
- Size: 31.3 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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
```ts
import {
isValidEmail,
isValidUsername,
isValidPhoneNumber,
isValidPassword,
} from "@crispengari/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:
Salt
Description
Value
Is Default
M8L1D1
Minimum eight characters, at least one letter and one number
"M8L1D1"
true
M8L1D1S1
Minimum eight characters, at least one letter, one number and one
special character
"M8L1D1S1"
false
M8L1U1D1S1
Minimum eight characters, at least one uppercase letter, one lowercase
letter and one number
"M8L1U1D1S1"
false
### 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 ``:
```ts
import { isValidPassword } from "@crispengari/regex-validator";console.log(isValidPassword("this_is9t@", passwordSalts.M8L1D1));
```