GithubHelp home page GithubHelp logo

mtarnovan / validators_ro Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 34 KB

Validators for Romanian CIF, CNP and IBAN in Elixir

License: MIT License

Elixir 100.00%
elixir cnp cif cui iban bic validations

validators_ro's Introduction

Validators for Romanian CIF, CNP and IBAN

CI status

An Elixir collection of validators and utilities around Romanian identifiers, extracted from openapi.ro, business APIs for Romanian developers.

Please note that IBAN validation is implemented per BNR specification and might not work for international IBANs.

For each identifier a valid_#{identifier}? function is provided.

Additionaly:

  • an infinite stream of valid CIFs is provided by cif_stream/1.
  • parse_cnp/1 allows parsing a valid CNP into constituent parts

Examples

    iex> import ValidatorsRo
    iex> valid_cif?("13548146")
    true
    iex> valid_cnp?("1920822296090")
    true
    iex> parse_cnp("1920822296090")
    %{parsed: %{control: "0", county_index: "609", county_of_birth: "Prahova",
        county_of_birth_code: "29", date_of_birth: "1992-08-22", foreign_resident: false,
        sex: "m"}, valid: true}
    iex> valid_iban?("RO56TREZ0462107020101XXX")
    true
    iex> valid_bic?("RZTIAT22263")
    true
    iex> cif_stream(10_000) |> Enum.take(10)
    [10004, 10012, 10020, 10039, 10047, 10055, 10063, 10071, 10080, 10098]

Installation

Add validators_ro to your list of dependencies in mix.exs:

def deps do
  [
    {:validators_ro, git: "https://github.com/mtarnovan/validators_ro.git"}
  ]
end

(Not published as a Hex package yet).

LICENSE

MIT LICENSE. See LICENSE for details.

validators_ro's People

Contributors

mtarnovan avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

ionutm87

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.