Functions to validate dictionary parity. Parity is tested on a map of dictionaries keyed by "flavor" (e.g. locale for i18n dictionaries, theme for theme dictionaries, etc):
(def dicts
{:en {:key1 "..."
:key2 "..."}
:nb {:key1 "..."
:key2 "..."}})
Validation functions return a list of maps of :dictionary
, :key
, and a
:kind
of problem. Some validators include additional keys to contextualize
the problem.
Functions to validate dictionary parity. Parity is tested on a map of dictionaries keyed by "flavor" (e.g. locale for i18n dictionaries, theme for theme dictionaries, etc): ```clj (def dicts {:en {:key1 "..." :key2 "..."} :nb {:key1 "..." :key2 "..."}}) ``` Validation functions return a list of maps of `:dictionary`, `:key`, and a `:kind` of problem. Some validators include additional keys to contextualize the problem.
(dfn? f x)
Returns true
if x
is a reference to the dictionary function f
, e.g.:
(dfn? :fn/str [:fn/str "Hello"]) ;;=> true
Returns `true` if `x` is a reference to the dictionary function `f`, e.g.: `(dfn? :fn/str [:fn/str "Hello"]) ;;=> true`
(find-fn-get-param-discrepancies dicts)
Returns a list of all keys whose values use a different set of parameters with
:fn/get
.
Returns a list of all keys whose values use a different set of parameters with `:fn/get`.
(find-fn-get-params x)
Recursively find all arguments used with :fn/get
in x
.
Recursively find all arguments used with `:fn/get` in `x`.
(find-interpolation-discrepancies dicts)
Returns a list of all keys whose values use a different set of string interpolations.
Returns a list of all keys whose values use a different set of string interpolations.
(find-misplaced-interpolations dicts)
Finds keys that use string interpolation syntax ({{:something}}) in strings
outside of :fn/str
.
Finds keys that use string interpolation syntax ({{:something}}) in strings outside of `:fn/str`.
(find-missing-keys dicts)
Finds all keys used across all dictionaries and returns a list of keys missing from individual dictionaries.
Finds all keys used across all dictionaries and returns a list of keys missing from individual dictionaries.
(find-non-kw-keys dicts)
Return a list of all keys across all dictionaries that are not keywords.
Return a list of all keys across all dictionaries that are not keywords.
(find-string-interpolations x)
Recursively find all :fn/str
references in x
Recursively find all `:fn/str` references in `x`
(find-type-discrepancies dicts)
Returns a list of all keys whose type is not the same across all dictionaries. The list will include one entry per dictionary for each key with type discrepancies.
Returns a list of all keys whose type is not the same across all dictionaries. The list will include one entry per dictionary for each key with type discrepancies.
(find-unqualified-keys dicts)
Return a list of all keys across all dictionaries that don't have a namespace.
Return a list of all keys across all dictionaries that don't have a namespace.
(find-val-discrepancies kind dicts)
Returns a list of all keys across all dictionaries that have different values.
Before calling this with dicts
, pass it through a function that replace
individual dictionary values with some symbolic type, e.g. call
map-dictionary-vals
with get-type
or similar. kind
is the :kind
to
assoc on the detected problems.
Returns a list of all keys across all dictionaries that have different values. Before calling this with `dicts`, pass it through a function that replace individual dictionary values with some symbolic type, e.g. call `map-dictionary-vals` with `get-type` or similar. `kind` is the `:kind` to assoc on the detected problems.
(format-report dicts problems)
Nicely format the list of problems as human-readable report
Nicely format the list of problems as human-readable report
Returns a label for the problem :kind
suitable for use in the formatted
report.
Returns a label for the problem `:kind` suitable for use in the formatted report.
(get-type x)
Returns :string
if the value is a string or a reference to :fn/str
,
otherwise the value's type
.
Returns `:string` if the value is a string or a reference to `:fn/str`, otherwise the value's `type`.
(map-dictionary-vals f dicts)
Maps of the values of each dictionary in dicts
and returns the result, which
is suitable for use with find-val-discrepancies
.
Maps of the values of each dictionary in `dicts` and returns the result, which is suitable for use with `find-val-discrepancies`.
(print-report dicts problems)
Print a human-readable problem report to stdout
Print a human-readable problem report to stdout
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close