aueda / maoli.js

JavaScript Helper library for common Brazilian business rules (CPF, CNPJ, and CEP).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#Maoli.js

Join the chat at https://gitter.im/aueda/maoli.js

Build Status

Versão em português: LEIAME.md

Maoli.js is JavaScript helper library for common brazilian business rules (CEP, CPF and CNPJ).

Currently implements:

  • CEP validation
  • CPF validation
  • CNPJ validation

For .NET server-side validation of CEP, CPF and CNPJ, please see Maoli.

Documentation

Cep

Maoli.Cep.validate(cep) - checks if a string value is a valid CEP representation. Returns true if CEP string is valid; false otherwise.

	if (window.Maoli.Cep.validate("99999-999"))
	{
	    console.log("CEP is valid");
	}

Cpf

Maoli.Cpf.validate(cpf) - checks if a string value is a valid CPF representation. Returns true if CPF string is valid; false otherwise.

	if (window.Maoli.Cpf.validate("999.999.99-99"))
	{
	    console.log("CPF is valid");
	}

Cnpj

Maoli.Cnpj.validate(cnpj) - checks if a string value is a valid CNPJ representation. Returns true if CNPJ string is valid; false otherwise.

	if (window.Maoli.Cnpj.validate("99.999.999/9999-99"))
	{
	    console.log("CPNJ is valid");
	}

NuGet Package

To install Maoli.js using NuGet, run the following command in the Package Manager Console:

PM> Install-Package Maoli.js

npm Package

To install Maoli.js using npm, run the following command in the console:

PM> npm install maoli

Source Code

Source code is available at GitHub.

License

This project is licensed under the MIT License.

Author

Adriano Ueda @adriueda

About

JavaScript Helper library for common Brazilian business rules (CPF, CNPJ, and CEP).

License:MIT License


Languages

Language:JavaScript 93.1%Language:CSS 5.8%Language:HTML 1.1%