utilsbr

Package Version Hex Docs Total Download License Last Updated

A Gleam library for Brazilian documents utilities. It provides functions to validate and generate CPF and CNPJ documents.

Installation

Run the following command in your project directory:

gleam add utilsbr@1

Basic usage

import utilsbr/cpf
import utilsbr/cnpj

pub fn main() {
  cpf.validate("123.456.789-09")
  cpf.strict_validate("123.456.789-09")
  cpf.generate(True)

  cnpj.validate("12.345.678/0001-09")
  cnpj.strict_validate("12.345.678/0001-09")
  cnpj.generate(True)
}

Further documentation can be found at https://hexdocs.pm/utilsbr.

Search Document