Url.Interpolate

Inject values from a Dict into a URI Template.

Documentation

Url.Interpolate provides a single function, interpolate, which takes a URI Template string and a Dict of variables, and expands the input string according to the rules in IETF RFC 6570, up to Level 3 (Level 4 compliance is not provided or planned).

This package was adapted from lukewestby/elm-string-interpolate.

Example:

interpolate "http://example.com/{path}{?x,y,empty}" <| 
    Dict.fromList [("path", "hello"), ("x", "1024"), ("y", "768")]

-- "http://example.com/hello?x=1024&y=768&empty="