Runlight.SearchParams (runlight v0.1.0)

Copy Markdown View Source

A URL's query as the WHATWG URLSearchParams reads it: an ordered list of {name, value} pairs, where a name may repeat.

Documented for its type; its functions are internal and can change in any release.

Summary

Functions

params.append(name, value).

params.delete(name).

The form encoding: letters, digits, and *-._ as they are, spaces as +, the rest escaped.

params.get(name), nil when it is not there.

params.getAll(name).

params.has(name).

new URLSearchParams(pairs) from a keyword list, a map, or pairs.

new URLSearchParams(text).

params.set(name, value): the first in place, the rest gone, or added at the end.

params.toString().

Types

t()

@type t() :: [{String.t(), String.t()}]

Functions

append(params, name, value)

@spec append(t(), String.t(), String.t()) :: t()

params.append(name, value).

delete(params, name)

@spec delete(t(), String.t()) :: t()

params.delete(name).

encode(text)

@spec encode(String.t()) :: String.t()

The form encoding: letters, digits, and *-._ as they are, spaces as +, the rest escaped.

get(params, name)

@spec get(t(), String.t()) :: String.t() | nil

params.get(name), nil when it is not there.

get_all(params, name)

@spec get_all(t(), String.t()) :: [String.t()]

params.getAll(name).

has?(params, name)

@spec has?(t(), String.t()) :: boolean()

params.has(name).

new(pairs)

@spec new(Enumerable.t()) :: t()

new URLSearchParams(pairs) from a keyword list, a map, or pairs.

parse(text)

@spec parse(String.t()) :: t()

new URLSearchParams(text).

set(params, name, value)

@spec set(t(), String.t(), String.t()) :: t()

params.set(name, value): the first in place, the rest gone, or added at the end.

to_string(params)

@spec to_string(t()) :: String.t()

params.toString().