krisajenkins/elm-exts/26.1.0

NOTE: this package is not compatible with Elm 0.19.1

Exts.Json.Decode

Extensions to the core Json.Decode library.

stringIgnoringBlanks : Decoder (Maybe String)

A decoder like (maybe string), except an empty or whitespace string is treated as Nothing.

Useful for dirty data-models.

decodeTime : Decoder Date

Decode a Date from seconds-since-the-epoch.

decodeDate : Decoder Date

Decode a Date from a string, using the same format as the core function Date.fromString.

parseWith : (a -> Result String b) -> a -> Decoder b

Lift a function that parses things, returning a Result, into the world of decoders.

If you're looking for the pre-0.18 function customDecoder, you can use something like this instead:

decodeUUID : Decoder UUID
decodeUUID =
    string
        |> andThen (parseWith UUID.fromString)