https://github.com/ericgj/elm-uri-template
URI templates for Elm
https://github.com/ericgj/elm-uri-template
Last synced: about 1 month ago
JSON representation
URI templates for Elm
- Host: GitHub
- URL: https://github.com/ericgj/elm-uri-template
- Owner: ericgj
- License: mit
- Created: 2020-01-05T22:51:17.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-05T23:08:46.000Z (over 6 years ago)
- Last Synced: 2025-01-16T00:35:17.688Z (over 1 year ago)
- Language: Elm
- Size: 25.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Url.Interpolate
Inject values from a Dict into a [URI Template][rfc6570].
## Documentation
`Url.Interpolate` provides a single function, `interpolate`, which takes
a [URI Template][rfc6570] string and a Dict of variables, and expands
the input string according to the rules in [IETF RFC 6570][rfc6570],
up to Level 3 (Level 4 compliance is not provided or planned).
This package was adapted from [lukewestby/elm-string-interpolate][lukewestby].
**Example:**
```elm
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="
```
[rfc6570]: https://tools.ietf.org/html/rfc6570
[lukewestby]: https://github.com/lukewestby/elm-string-interpolate