Official documentation

Welcome to the main page of Multiform Validator! Here, you will find detailed documentation for various functions provided by Multiform Validator, a useful JavaScript library for data validation. Each function is designed to assist in validating different types of data, making your code more robust and secure. Multiform Validator consists of a series of specialized functions that allow you to validate various data types, such as emails, passwords, names, surnames, passport numbers, phone numbers, and more. Each function has configurable parameters and provides customizable error messages to suit your project's needs. On each documentation page, you will find a comprehensive description of the function, including its purpose, accepted parameters, and usage examples. Additionally, you will have access to details about default error messages and how to customize them to fit your application. By using Multiform Validator, you can ensure that user input in your forms is correct and compliant with the established rules. This validation is essential to prevent issues such as invalid entries, corrupted data, or security vulnerabilities. We are continuously working to enhance and expand Multiform Validator with new features and improvements to make it an even more powerful and flexible tool for your validation needs. We hope that these documentations prove to be helpful and simplify the usage of Multiform Validator in your projects. Feel free to explore the various available functions and do not hesitate to reach out to us if you have any questions or suggestions. Thank you for choosing Multiform Validator as your data validation tool, and we wish you success in your projects! Multiform Validator Team

Multiform-validator

npm versionLicense: MITnpm downloads

This npm package provides JavaScript functions to validate various forms fields.

If you want to help me, you can buy me a coffee (:

Buy Me A Coffee

INFO:

All functions that have the name "validate" return an object with two properties, isValid: true | false and errorMsg: 'String with errors'

The remaining ones can return true|false|string|array, look at the doc for each one

Feel free to find bugs and report them to me. Your feedback is highly appreciated. Hugs from Gabriel Logan!

CDN's

jsDelivr

https://cdn.jsdelivr.net/npm/multiform-validator@2.1.2/dist/bundle.min.js
<script src="https://cdn.jsdelivr.net/npm/multiform-validator@2.1.2/dist/bundle.min.js"></script>

unpkg

https://unpkg.com/multiform-validator@2.1.2/dist/bundle.js
<script src="https://unpkg.com/multiform-validator@2.1.2/dist/bundle.js"></script>

Example of use with CDN

<script src="https://cdn.jsdelivr.net/npm/multiform-validator@2.1.2/dist/bundle.min.js"></script>

<script>
	const emailResult = isEmail('123456');
	const cpfResult = cpfIsValid('123456');

	console.log(emailResult); // returns false
	console.log(cpfResult.isValid); // returns false
</script>

Installation

npm install multiform-validator
yarn add multiform-validator

Data Validator

This package contains various modules for validating different types of data. Below are the available validation modules:

Available Validation Modules

  • cnpjValidator: CNPJ validation.
  • cpfValidator: CPF validation.
  • getOnlyEmail: Extracts only the email or emails address from a string.
  • identifyFlagCard: Identifies the flag of a credit card.
  • isAscii: Checks if the string contains only ASCII characters.
  • isBase64: Checks if the string is a valid Base64 encoding.
  • isCEP: CEP validation (Brazilian postal code).
  • isCreditCardValid: Credit card validation.
  • isDate: Date format validation.
  • isDecimal: Checks if the number is a decimal.
  • isEmail: Email address validation format.
  • isEmpty: Checks if the string is empty.
  • isMACAddress: MAC address validation.
  • isMD5: Checks if the string is a valid MD5 hash.
  • isNumber: Checks if the value is a number.
  • isPort: Port number validation.
  • isPostalCode: Postal code validation.
  • isTime: Time format validation.
  • isValidAudio Audio file validation.
  • isValidImage Image file validation.
  • isValidPdf Pdf file validation.
  • isValidTxt Txt file validation.
  • isValidVideo Video file validation.
  • passwordStrengthTester: Password strength test.
  • validateBRPhoneNumber: Brazilian phone number validation.
  • validateEmail: Email address full validation.
  • validateName: Name validation.
  • validatePassportNumber: Passport number validation.
  • validatePassword: Password validation.
  • validatePhoneNumber: Phone number validation.
  • validateSurname: Surname validation.
  • validateTextarea: Textarea validation.
  • validateUsername: Username validation.
  • validateUSPhoneNumber: US phone number validation.

if you prefer, you can use importing as:

const validator = require('multiform-validator');
// or
import validator from 'multiform-validator';

Attention, FUNCTION_NAME is not a valid function name!
It is just an example of how to import the functions.

const { FUNCTION_NAME } = require('multiform-validator');
// or
import { FUNCTION_NAME } from 'multiform-validator';

/**
* There are other returns in some functions, with strings etc, stay tuned
*/

If you want to help me, you can buy me a coffee (:

Buy Me A Coffee

Feel free to explore the various functions and experiment with different inputs to understand their behavior. If you encounter any issues or have suggestions, don't hesitate to reach out to me. Your feedback is valuable and helps improve the package. Happy coding!

By - Gabriel Logan