npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

brformsvalidator

v3.0.3

Published

FormsValidator is a comprehensive JavaScript library designed to validate various types of form inputs. This library provides a robust set of validators for common form fields such as CNPJ, CPF, email, name, date, and username. It ensures that the data en

Downloads

22

Readme

BrFormsValidator

Overview

BrFormsValidator is a comprehensive library designed to validate various types of Brazilian forms data, including CNPJ, CPF, email, name, date, US date, and username. This module ensures that your form inputs are correctly formatted and valid according to Brazilian standards.

Features

  • Validate CNPJ
  • Validate CPF
  • Validate email
  • Validate name and surname
  • Validate date in Brazilian format
  • Validate date in US format
  • Validate username with customizable length

Installation

To install BrFormsValidator, you can use npm with the following commands:

Default Instalation

npm install brformsvalidator

Instalation As Production Dependencie

npm install brformsvalidator --save

Instalation As Dev Dependencie

npm install brformsvalidator --save-dev

Usage

Importing the Module

To use BrFormsValidator in your project, you need to import it as follows:

const BrFormsValidator = require('brformsvalidator');

Examples

Using the Full Validator

const BrFormsValidator = require('brformsvalidator');

const validator = new BrFormsValidator('12345678000195', '12345678909', '[email protected]', 'John', 'Doe', '01/01/2000',

 '

01/01/2000', 'username123');

// Validate CNPJ
const [isCnpjValid, cnpjError] = validator.validateCnpj();
console.log(isCnpjValid, cnpjError);

// Validate CPF
const [isCpfValid, cpfError] = validator.validateCpf();
console.log(isCpfValid, cpfError);

// Validate email
const [isEmailValid, emailError] = validator.validateEmail();
console.log(isEmailValid, emailError);

// Validate name
const [isNameValid, nameError] = validator.validateName();
console.log(isNameValid, nameError);

// Validate date
const [isDateValid, dateError] = validator.validateDate();
console.log(isDateValid, dateError);

// Validate US date
const [isUsDateValid, usDateError] = validator.validateUsDate();
console.log(isUsDateValid, usDateError);

// Validate username
const [isUsernameValid, usernameError] = validator.validateUsername();
console.log(isUsernameValid, usernameError);

Using Only Specific Validators

Example: Only CPF

const BrFormsValidator = require('brformsvalidator');

const cpfValidator = new BrFormsValidator('', '12345678909');

const [isCpfValid, cpfError] = cpfValidator.validateCpf();
console.log(isCpfValid, cpfError);

Example: Only Email

const BrFormsValidator = require('brformsvalidator');

const emailValidator = new BrFormsValidator('', '', '[email protected]');

const [isEmailValid, emailError] = emailValidator.validateEmail();
console.log(isEmailValid, emailError);

Methods and Properties

  • validateCnpj(): Validates the CNPJ.
  • validateCpf(): Validates the CPF.
  • validateEmail(): Validates the email.
  • validateName(): Validates the name and surname.
  • validateDate(): Validates the date in Brazilian format.
  • validateUsDate(): Validates the date in US format.
  • validateUsername(): Validates the username.

Contributing

We welcome contributions from the community. If you would like to contribute, please fork the repository and submit a pull request.

License

This project is licensed under the MIT License.

Author

  • Name: Danilo Santana
  • Username: engdanilo

Contributors

Currently, the only contributor is the author, Danilo Santana.