No description
|
||
---|---|---|
.forgejo/workflows | ||
.vscode | ||
src | ||
.gitignore | ||
jest.config.js | ||
package-lock.json | ||
package.json | ||
README.en.md | ||
README.md | ||
tsconfig.json |
Library with functions for Brazilian data formatting.
CPF/CNPJ: Returns either CPF or CNPJ format based on the input length.
import { formatarCep } from "lhmask";
console.log(formatarCep("12345000")); // Output: 12.345-000
console.log(formatarCnpj("12123456000100")); // Output 12.123.456/0001-00
console.log(formatarCpf("12345678900")); // Output: 123.456.789-00
console.log(formatarCpfCnpj("12123456000100")); // Output 12.123.456/0001-00
console.log(formatarCpfCnpj("12345678900")); // Output: 123.456.789-00
console.log(formatarContaBancaria("12345")); // Output: 1234-5
console.log(formatarTelefone("88912341234")); // Output: (88)91234-1234.
console.log(formatarTelefone("8834001234")); // Output: (88)3400-1234.
console.log(formatarTelefone("08001234567")); // Output: 0800-123-4567
// Returns the formatted value according to the specified string.
// Possible values: cep, cpf, cnpj, cpfcnpj, contabancaria.
console.log(formatarValor("12345", "contabancaria")); // Output: 1234-5