Skip to content

Latest commit

 

History

History
50 lines (42 loc) · 1011 Bytes

README.md

File metadata and controls

50 lines (42 loc) · 1011 Bytes

personnummer

Package Version Hex Docs

gleam add personnummer
import personnummer

pub fn main() {
  let assert Ok(pnr) = personnummer.new("19900101-0017")
  io.debug(
    [
      "The person with personal identity number ",
      pnr
        |> personnummer.format(True),
      " is a ",
      case
        pnr
        |> personnummer.is_male()
      {
        True -> "male"
        False -> "female"
      },
      " of age ",
      pnr
        |> personnummer.age
        |> int.to_string(),
    ]
    |> string.concat,
  )
}
"The person with personal identity number 19900101-0017 is a male of age 34"

Further documentation can be found at https://hexdocs.pm/personnummer.

Development

gleam run   # Run the project
gleam test  # Run the tests
gleam shell # Run an Erlang shell