Liking cljdoc? Tell your friends :D

strojure.ring-lib.util.codec

Functions for encoding and decoding data.

Functions for encoding and decoding data.
raw docstring

assoc-param-rfclj

(assoc-param-rf {:keys [vector-param-name-fn param-name-fn]
                 :or {vector-param-name-fn vector-param-name-suffix}})

Returns reducing function (fn [m k v]) to collect sequence of parameters in map. Configuration options:

  • :vector-param-name-fn – a function (fn [param-name] vector-param-name).

    • Returns param name for params which should be collected in vectors.
    • Default is vector-param-name-suffix which uses suffix [] in names.
  • :param-name-fn – a function (fn [param-name] ...).

    • Converts string name to another type i.e. keyword.
    • Default is not defined.
Returns reducing function `(fn [m k v])` to collect sequence of parameters in
map. Configuration options:

- `:vector-param-name-fn` – a function `(fn [param-name] vector-param-name)`.
    + Returns param name for params which should be collected in vectors.
    + Default is [[vector-param-name-suffix]] which uses suffix `[]` in names.

- `:param-name-fn` – a function `(fn [param-name] ...)`.
    + Converts string name to another type i.e. keyword.
    + Default is not defined.
sourceraw docstring

form-decode-fnclj

(form-decode-fn {:keys [vector-param-name-fn param-name-fn]})
(form-decode-fn rf)

Returns function (fn [s] params) to convert params string (query string, form params) to persistent map. Configuration options:

  • :vector-param-name-fn – a function (fn [param-name] vector-param-name).

    • Returns param name for params which should be collected in vectors.
    • Default is vector-param-name-suffix which uses suffix [] in names.
  • :param-name-fn – a function (fn [param-name] ...).

    • Converts string name to another type i.e. keyword.
    • Default is not defined.

Accepts custom reducing function rf instead of opts map.

Returns function `(fn [s] params)` to convert params string (query string,
form params) to persistent map. Configuration options:

- `:vector-param-name-fn` – a function `(fn [param-name] vector-param-name)`.
    + Returns param name for params which should be collected in vectors.
    + Default is [[vector-param-name-suffix]] which uses suffix `[]` in names.

- `:param-name-fn` – a function `(fn [param-name] ...)`.
    + Converts string name to another type i.e. keyword.
    + Default is not defined.

Accepts custom reducing function `rf` instead of `opts` map.
sourceraw docstring

reduce-param-tokenclj

(reduce-param-token rf result s)

Adds param token string s into result using reducing function (fn [result key value] new-result), where s is a URL encoded key/value pair like key=value. Raise exception if UTF-8 decode fails.

Adds param token string `s` into `result` using reducing function
`(fn [result key value] new-result)`, where `s` is a URL encoded key/value
pair like `key=value`. Raise exception if UTF-8 decode fails.
sourceraw docstring

vector-param-name-suffixclj

(vector-param-name-suffix s)

Default implementation of :vector-param-name-fn in assoc-param-rf. Returns param name without suffix [] or nil if s does not end with []. Used to collect only parameters with [] in vectors.

Default implementation of `:vector-param-name-fn` in [[assoc-param-rf]].
Returns param name without suffix `[]` or `nil` if `s` does not end with `[]`.
Used to collect only parameters with `[]` in vectors.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close