Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vinibrsl/burocracia.cr

👔 Zero-dependency Crystal shard to validate, generate and format Brazilian burocracias (CPF, CNPJ, CEP)
https://github.com/vinibrsl/burocracia.cr

brasil brazil cep cnpj cpf crystal crystal-language

Last synced: 15 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# burocracia.cr [![Dependencies](https://img.shields.io/badge/dependencies-0-green.svg)](#) [![GitHub license](https://img.shields.io/github/license/vinibrsl/burocracia.cr.svg)](https://github.com/vinibrsl/burocracia.cr/blob/master/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`:

```yaml
dependencies:
burocracia:
github: vinibrsl/burocracia.cr
```

## Usage

```crystal
require "burocracia"

Burocracia::CEP.generate
=> "23230133"

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

Burocracia::CEP::Address.find "80210-130"
=> #

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](https://vinibrsl.github.io/burocracia.cr/Burocracia).

## 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](https://github.com/vinibrsl) Vinicius Brasil - creator, maintainer