nyarly/elm-uri-template/1.0.0

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 4

This package was forked from ericgj/elm-uri-template This package was adapted from lukewestby/elm-string-interpolate.

Example:

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

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