Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebastiandotdev/validateform
A library that validates forms, avoids the use of regular expressions in a verbose way
https://github.com/sebastiandotdev/validateform
Last synced: 25 days ago
JSON representation
A library that validates forms, avoids the use of regular expressions in a verbose way
- Host: GitHub
- URL: https://github.com/sebastiandotdev/validateform
- Owner: sebastiandotdev
- Created: 2023-03-23T20:03:43.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-03-25T21:31:40.000Z (over 1 year ago)
- Last Synced: 2024-10-11T11:04:04.147Z (26 days ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/validator-form-js
- Size: 50.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# validate Form
- A library that validates forms, avoids the use of regular expressions in a verbose way
## Instalacion
- you must follow the following steps for the installation
```npm
npm install validator-form-js --save-dev
```## Usage
- Next I will provide you with small examples using different types of validations
- `email`
```ts
import {Validator} from 'validator-form-js';const emailInput = document.getElementById("email") as HTMLInputElement;
const email = emailInput.value;if (Validator.isEmailValid(email)) {
// dirección de correo electrónico válida
} else {
// dirección de correo electrónico no válida
}
```- `password`
```ts
import {Validator} from 'validator-form-js';const passwordInput = document.getElementById("password") as HTMLInputElement;
const password = passwordInput.value;if (Validator.isPasswordValid(password)) {
// contraseña válida
} else {
// contraseña no válida
}
```- `phone number`
```ts
import {Validator} from 'validator-form-js';const phoneInput = document.getElementById("phone") as HTMLInputElement;
const phoneNumber = phoneInput.value;if (Validator.isPhoneNumberValid(phoneNumber)) {
// número de teléfono válido
} else {
// número de teléfono no válido
}
```## Unit Test
```npm
npm test
```## Author
- johan Sebastian Castro Garcia