m00qek / elm-cpf / Cpf

Manipulate and generate brazilian CPFs


type alias CPF =
Internals.CPF

A brazilian CPF


type Error
    = InvalidInput
    | InvalidLength
    | InvalidFirstDV
    | InvalidSecondDV

Possible errors when dealing with CPFs

fromList : List Basics.Int -> Result Error CPF

Turn a valid list of integers into a CPF.

(fromList [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 9 ] |> Result.map show) == Ok "123.456.789-09"

fromText : String -> Result Error CPF

Turn a valid string into a CPF.

(fromText "12345678909" |> Result.map show) == Ok "123.456.789-09"

(fromText "123.456.789-09" |> Result.map show) == Ok "123.456.789-09"

toString : CPF -> String

Turn a CPF into a string.

show : CPF -> String

Pretty print a given CPF