Skip to content

👔 Zero-dependency Crystal shard to validate, generate and format Brazilian burocracias (CPF, CNPJ, CEP)

License

Notifications You must be signed in to change notification settings

vinibrsl/burocracia.cr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

burocracia.cr Dependencies GitHub license

All Brazilian boring burocracias solved

burocracia.cr is the dependecyless Crystal shard to validate, generate and format Brazilian burocracias such as CPF, CNPJ and CEP.

Installation

Add this to your application's shard.yml:

dependencies:
  burocracia:
    github: vinibrsl/burocracia.cr

Usage

require "burocracia"

Burocracia::CEP.generate
=> "23230133"

Burocracia::CEP.generate(format: true)
=> "71946-192"

Burocracia::CEP::Address.find "80210-130"
=> #<CEP::Address:0x10e1b83c0 @cep="80210130", @neighborhood="Jardim Botânico", @city="Curitiba", @street="Rua José Ananias Mauad", @state="Paraná", @state_abbreviation="PR">

Burocracia::CPF.valid?("10880423971")
=> false

Burocracia::CNPJ.format("92583745000149")
=> "92.583.745/0001-49"

Burocracia::CNPJ.sanitize("92.583.745/0001-49")
=> "92583745000149"

Read the full documentation here.

Contributing

  1. Fork it ( https://github.com/vinibrsl/burocracia.cr/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Please, don't forget to document the code and run crystal docs to apply the changes to /docs folder.

Contributors

  • vinibrsl Vinicius Brasil - creator, maintainer

About

👔 Zero-dependency Crystal shard to validate, generate and format Brazilian burocracias (CPF, CNPJ, CEP)

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published