No description
Find a file
Leandro Costa 522f4103bb
Some checks failed
CI Pipeline / build-and-test (push) Successful in 1m1s
CI Pipeline / check-version (push) Successful in 11s
CI Pipeline / mirror (push) Failing after 12s
CI Pipeline / publish-staging (push) Has been skipped
CI Pipeline / publish-production (push) Has been skipped
ci: pushing just HEAD to mirror
2025-05-28 09:24:59 -03:00
.forgejo/workflows ci: pushing just HEAD to mirror 2025-05-28 09:24:59 -03:00
.vscode feat: typescript 2024-06-17 20:11:08 -03:00
src feat: typescript 2024-06-17 20:11:08 -03:00
.gitignore feat: typescript 2024-06-17 20:11:08 -03:00
bitbucket-pipelines.yml chore: copiando o readme 2024-06-17 20:38:18 -03:00
jest.config.js chore: removing type module 2024-06-17 20:54:43 -03:00
package-lock.json [skip CI] Version 1.1.7 2024-06-17 23:55:31 +00:00
package.json npm: 1.1.9 2025-05-26 09:52:46 -03:00
README.en.md feat: add en readme 2025-05-25 19:11:01 -03:00
README.md feat: add en readme 2025-05-25 19:11:01 -03:00
tsconfig.json chore: fix build destiation 2024-06-17 20:23:46 -03:00

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