peselx v0.2.0 Peselx

Provides function validate/1 to check PESEL number.

Checks:

  • Control digit
  • Length

Control digit check base on algorithm descibed in this article.

Summary

Functions

Validate PESEL number

Functions

validate(pesel)

Specs

validate(String.t) :: {atom, String.t}

Validate PESEL number.

## Parameters

- pesel: String represents PESEL number.

## Examples

iex> Peselx.validate("04231115629")
    {:ok, "Valid"}

    iex> Peselx.validate("04231115628")
    {:error, "Wrong checksum"}

    iex> Peselx.validate("4231115629")
    {:error, "Wrong length"}

    iex> Peselx.validate("004231115629")
    {:error, "Wrong length"}