Liking cljdoc? Tell your friends :D

exoscale.coax


cached-coerce-fnclj/s

(cached-coerce-fn spec opts)

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.
raw 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
raw 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.
raw docstring

coerce-fnclj/s

(coerce-fn spec opts)

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.
raw 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.
raw docstring

coercer-cacheclj/s


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
raw 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.
raw 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.
raw 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

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/forms, otherwise 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/forms, otherwise it returns the
identity coercer
raw docstring

gen-coerce-andclj/s

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

gen-coerce-coll-ofclj/s

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

gen-coerce-keysclj/s

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

gen-coerce-map-ofclj/s

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

gen-coerce-mergeclj/s

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

gen-coerce-multi-specclj/s

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

gen-coerce-nilableclj/s

(gen-coerce-nilable [_ spec])

gen-coerce-orclj/s

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

gen-coerce-tupleclj/s

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

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
raw docstring

update-cache!clj/s

(update-cache! cache k coercer)

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

× close