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

array-suffix-nameclj

(array-suffix-name s)

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

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

assoc-param-rfclj

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

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

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

    • Returns param name for params which should be collected in vectors.
    • Default is array-suffix-name which uses suffix [] in names.
  • :param-key-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:

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

- `:param-key-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 [array-name-fn param-key-fn]})
(form-decode-fn rf)

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

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

    • Returns param name for params which should be collected in vectors.
    • Default is array-suffix-name which uses suffix [] in names.
  • :param-key-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:

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

- `:param-key-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

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

× close