Liking cljdoc? Tell your friends :D

exoscale.coax


cached-coerce-fnclj/s

(cached-coerce-fn spec opts)
source

coerceclj/s

(coerce spec x)
(coerce spec x opts)

Coerce a value x using spec/coercer spec. This function will first try to use a coercer from the registry, otherwise it will try to infer a coercer from the spec with the same name or matching symbol. Returns original value in case a coercer can't be found.

Coerce a value `x` using spec/coercer `spec`. This function will
first try to use a coercer from the registry, otherwise it will try
to infer a coercer from the spec with the same name or matching
symbol. Returns original value in case a coercer can't be found.
sourceraw docstring

coerce!clj/s

(coerce! spec x)
(coerce! spec x opts)

Like coerce, but will call s/assert on the result, making it throw an error if value doesn't comply after coercion. Only works with registered specs

Like coerce, but will call s/assert on the result, making it throw an
error if value doesn't comply after coercion. Only works with
registered specs
sourceraw docstring

coerce*clj/s

(coerce* spec x opts)

Like coerce, but if it can't find a way to coerce the original value will return :exoscale.coax/invalid. Mostly useful for implementation of special forms like s/or.

Like coerce, but if it can't find a way to coerce the original value
will return `:exoscale.coax/invalid`. Mostly useful for
implementation of special forms like s/or.
sourceraw docstring

coerce-fnclj/s

(coerce-fn spec opts)
source

coerce-fn*clj/s

(coerce-fn* spec {:exoscale.coax/keys [idents] :as opts})

Get the coercing function from a given key. First it tries to lookup the coercion on the registry, otherwise try to infer from the specs. In case nothing is found, identity function is returned.

Get the coercing function from a given key. First it tries to lookup
the coercion on the registry, otherwise try to infer from the
specs. In case nothing is found, identity function is returned.
sourceraw docstring

coerce-structureclj/s

(coerce-structure x)
(coerce-structure x {:exoscale.coax/keys [idents op] :or {op coerce} :as opts})

Recursively coerce map values on a structure.

Recursively coerce map values on a structure.
sourceraw docstring

coercer-cacheclj/s

source

conformclj/s

(conform spec x)
(conform spec x opts)

Like coerce, and will call s/conform on the result. Only works with registered specs

Like coerce, and will call s/conform on the result. Only works with
registered specs
sourceraw docstring

defclj/smacro

(def k coercion)

Given a namespace-qualified keyword, and a coerce function, makes an entry in the registry mapping k to the coerce function.

Given a namespace-qualified keyword, and a coerce function, makes an
entry in the registry mapping k to the coerce function.
sourceraw docstring

enum?clj/s

(enum? x)

If the spec is given as a set, and every member of the set is the same type, then we can infer a coercion from that shared type.

If the spec is given as a set, and every member of the set is the same type,
then we can infer a coercion from that shared type.
sourceraw docstring

EnumKeyclj/sprotocol

enum-keyclj/s

(enum-key x)

takes enum value x and returns matching predicate to resolve coercer from registry

takes enum value `x` and returns matching predicate to resolve
coercer from registry
source

find-coercerclj/s

(find-coercer spec {:as opts :exoscale.coax/keys [enums]})

Tries to find coercer by looking into registry. First looking at :exoscale.coax/idents if value is a qualified-keyword or qualified symbol, or checking if the value is an enum value (homogeneous set) and lastly if it's a s-exp form that indicates a spec form likely it will return it's generated coercer from registry :exoscale.coax/form , otherwise the it returns the identity coercer

Tries to find coercer by looking into registry.
First looking at :exoscale.coax/idents if value is a
qualified-keyword or qualified symbol, or checking if the value is
an enum value (homogeneous set) and lastly if it's a s-exp form that
indicates a spec form likely it will return it's generated coercer
from registry :exoscale.coax/form , otherwise the it returns the
identity coercer
sourceraw docstring

gen-coerce-andclj/s

(gen-coerce-and [_ & [spec]])
source

gen-coerce-coll-ofclj/s

(gen-coerce-coll-of [_ spec & {:as _opts :keys [kind]}])
source

gen-coerce-keysclj/s

(gen-coerce-keys [_ & {:keys [req-un opt-un]}])
source

gen-coerce-map-ofclj/s

(gen-coerce-map-of [_ kspec vspec & _])
source

gen-coerce-mergeclj/s

(gen-coerce-merge [_ & spec-forms])
source

gen-coerce-multi-specclj/s

(gen-coerce-multi-spec [_ f retag & _ :as spec-expr])
source

gen-coerce-nilableclj/s

(gen-coerce-nilable [_ spec])
source

gen-coerce-orclj/s

(gen-coerce-or [_ & pairs])
source

gen-coerce-tupleclj/s

(gen-coerce-tuple [_ & specs])
source

registryclj/s

(registry)

returns the registry map, prefer 'get-spec' to lookup a spec by name

returns the registry map, prefer 'get-spec' to lookup a spec by name
sourceraw docstring

update-cache!clj/s

(update-cache! cache k coercer)
source

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

× close