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.
gleam run # Run the project
gleam test # Run the tests
gleam shell # Run an Erlang shell