Try Install Learn Blog API Packages GitHub
Pages
core

Search
Entities

SearchParams

Functions

append
(
params
:
SearchParams
key
:
String
value
:
String
)
:
SearchParams

Appends a specified key/value pair as a new search parameter.

SearchParams.empty()
|> SearchParams.append("key", "value")
contains
(
params
:
SearchParams
key
:
String
)
:
Bool

Returns a Bool indicating if such a search parameter exists.

(SearchParams.fromString("key=value")
 |> SearchParams.contains("key")) == true
delete
(
params
:
SearchParams
key
:
String
)
:
SearchParams

Deletes the given search parameter, and its associated value, from the list of all search parameters.

SearchParams.fromString("key=value")
|> SearchParams.delete("key")
empty
:
SearchParams

Returns an empty search parameters object.

SearchParams.empty()
fromString
(
value
:
String
)
:
SearchParams

Parses a string into a search parameters object.

SearchParams.fromString("key=value")
get
(
params
:
SearchParams
key
:
String
)
:
Maybe(String)

Returns the first value associated to the given search parameter.

(SearchParams.fromString("key=value")
 |> SearchParams.get("key")) == "value"
set
(
params
:
SearchParams
key
:
String
value
:
String
)
:
SearchParams

Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.

SearchParams.empty()
|> SearchParams.set("key", "value")
toString
(
params
:
SearchParams
)
:
String

Returns a string containing a query string suitable for use in a URL.

(SearchParams.empty()
 |> SearchParams.set("key", "value")
 |> SearchParams.toString()) == "key=value"