GithubHelp home page GithubHelp logo

vinibrsl / burocracia.cr Goto Github PK

View Code? Open in Web Editor NEW
20.0 3.0 5.0 74 KB

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

License: MIT License

Crystal 100.00%
crystal crystal-language brazil brasil cep cnpj cpf

burocracia.cr's Introduction

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

burocracia.cr's People

Contributors

hugoabonizio avatar vinibrsl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

burocracia.cr's Issues

CNPJ validation, generation and formatting

Is your feature request related to a problem? Please describe.
The CNPJ is one of the Brazilian most important documents, used to identify companies.

Describe the solution you'd like
The CNPJ should be just like the CPF module, but with the correspondent validation algorithm.

Module to cover Brazilian phone numbers

Brazilians phone numbers can be hard to generate, validate and format, seen that there are at least three types of phone numbers in Brazil:

  • Landline phones, eg.: +55 XX 3XXX-XXXX
  • Mobile phones, eg.: +55 XX 9XXXX-XXXX or +55 XX 9XXX-XXXX
  • Non-geographic phones, eg.: 0X00 XXX XXXX

It would be great to provide methods to:

  • Validate phone numbers by type
  • Generate phone numbers by type
  • Recognize phone number types
  • Format phone numbers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.