Skip to content

🔢 Validate Swedish personal identity numbers

License

Notifications You must be signed in to change notification settings

personnummer/gleam

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

🔢 Validate Swedish personal identity numbers

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages

  • Gleam 100.0%