I'd like to grab the Total-Records
key of a response.headers
HTTP response.
Problem is that in some browser it is as returned by the server Total-Records
but in some other, it is in lower case.
I'd like to get the value of the Total-Records
header regardless of its case.
How would you do that?
Yet another alternative is to use the find
function from elm-community/dict-extra
to provide a custom comparison operator:
import Dict.Extra
caseInsensitiveGet : String -> Dict String v -> Maybe v
caseInsensitiveGet key =
let
lowerKey = String.toLower key
in
Dict.Extra.find (\k _ -> String.toLower k == lowerKey)
>> Maybe.map Tuple.second
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With