Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/ pastry Public

Turn maps and keyword lists into query strings.

Notifications You must be signed in to change notification settings

aguxez/pastry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

21 Commits

Repository files navigation

Pastry - Turn maps and keyword lists into query Strings.

Pastry is a Quiche fork in Elixir. Build Status

Install

{:pastry, "~> 0.3.0"}

Usage

iex> Pastry.to_query_string(%{param: ~w(this is a parameters list), words: "Elixir is fun!"})
"?param=this&param=is&param=a&param=parameters&param=list&words=Elixir%20is%20fun!"
Pastry.to_query_string([param: ~w(this is a parameters list), words: "Elixir is fun!"])
"?param=this&param=is&param=a&param=parameters&param=list&words=Elixir%20is%20fun!"

You can pass options as to which type of case to use

# use "camel" or "pascal"
iex> Pastry.to_query_string([some_words: ~w(some list), text_word: "Pascal"], case: "pascal")
"?SomeWords=some&SomeWords=list&TextWord=Pascal"
...
iex> Pastry.to_query_string(%{some_words: "A word"}, case: "camel")
"?someWords=A%20word"

And if passing case options is not enough

You can just pass an arity 1 function with the :func option

iex> Pastry.to_query_string([text_message: "some word"], func: &String.upcase/1)
"?TEXT_MESSAGE=some%20word"

About

Turn maps and keyword lists into query strings.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /