Created
May 1, 2016 18:22
-
-
Save Tim-Machine/a11d53c1aa7dcbe36fa975b9f8979e69 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @doc """ | |
| takes a map and converts it to a query string | |
| example build_qeury_string %{locale: "en_US", another: "test"} | |
| """ | |
| def build_query_string(data) when is_map(data) do | |
| data = for {key, val} <- data, into: [], do: "#{key}=#{val}" | |
| Enum.join(data, "&") | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment