Liking cljdoc? Tell your friends :D

spec-tools.core


+problems+clj/s

source

coerceclj/s

(coerce spec value transformer)
(coerce spec value transformer options)

Coerces the value using a Transformer. Returns original value for those parts of the value that can't be trasformed.

Coerces the value using a [[Transformer]]. Returns original value for
those parts of the value that can't be trasformed.
sourceraw docstring

Coercionclj/s≠protocol

-coerceclj/s

(-coerce this value transformer options)
source

conformclj/s

(conform spec value)
(conform spec value transformer)

Given a spec and a value, returns the possibly destructured value or ::s/invalid

Given a spec and a value, returns the possibly destructured value
or ::s/invalid
sourceraw docstring

conform!clj/s

(conform! spec value)
(conform! spec value transformer)

Given a spec and a value, returns the possibly destructured value or fails with ex-info with :type of ::conform. ex-data also contains :problems, :spec and :value. call s/unform on the result to get the actual conformed value.

Given a spec and a value, returns the possibly destructured value
or fails with ex-info with :type of ::conform. ex-data also contains
:problems, :spec and :value. call s/unform on the result to get the
actual conformed value.
sourceraw docstring

create-specclj/s

(create-spec {:keys [spec type form] :as m})

Creates a Spec intance from a map containing the following keys:

   :spec  the wrapped spec predicate (mandatory)
   :form  source code of the spec predicate, if :spec is a spec,
          :form is read with `s/form` out of it. For non-spec
          preds, spec-tools.form/resolve-form is called, if still
          not available, spec-creation will fail.
   :type  optional type for the spec. if not set, will be auto-
          resolved via spec-tools.parse/parse-spec (optional)
 :reason  reason to be added to problems with s/explain (optional)
    :gen  generator function for the spec (optional)
   :name  name of the spec (optional)

:description description of the spec (optional) :xx/yy any qualified keys can be added (optional)

Creates a Spec intance from a map containing the following keys:

       :spec  the wrapped spec predicate (mandatory)
       :form  source code of the spec predicate, if :spec is a spec,
              :form is read with `s/form` out of it. For non-spec
              preds, spec-tools.form/resolve-form is called, if still
              not available, spec-creation will fail.
       :type  optional type for the spec. if not set, will be auto-
              resolved via spec-tools.parse/parse-spec (optional)
     :reason  reason to be added to problems with s/explain (optional)
        :gen  generator function for the spec (optional)
       :name  name of the spec (optional)
:description  description of the spec (optional)
      :xx/yy  any qualified keys can be added (optional)
sourceraw docstring

decodeclj/s

(decode spec value)
(decode spec value transformer)

Decodes a value using a Transformer from external format to a value defined by the spec. First, calls coerce and returns the value if it's valid - otherwise, calls conform & [[unform]]. Returns ::s/invalid if the value can't be decoded to conform the spec.

Decodes a value using a [[Transformer]] from external format to a value
defined by the spec. First, calls [[coerce]] and returns the value if it's
valid - otherwise, calls [[conform]] & [[unform]]. Returns `::s/invalid`
if the value can't be decoded to conform the spec.
sourceraw docstring

encodeclj/s

(encode spec value transformer)

Transforms a value (using a Transformer) from external format into a value defined by the spec. On error, returns ::s/invalid.

Transforms a value (using a [[Transformer]]) from external
format into a value defined by the spec. On error, returns `::s/invalid`.
sourceraw docstring

explainclj/s

(explain spec value)
(explain spec value transformer)
source

explain-dataclj/s

(explain-data spec value)
(explain-data spec value transformer)
source

fail-on-extra-keys-transformerclj/s

source

into-specclj/s

(into-spec x)
source

json-transformerclj/s

source

mergeclj/smacro

(merge & forms)
source

merge-implclj/s

(merge-impl forms spec-form merge-spec)
source

select-specclj/s

(select-spec spec value)

Drops all extra keys out of a Keys spec value. To use this recursively, wrap all child Keys Specs into Spec Records. See CLJ-2116 for details.

Drops all extra keys out of a Keys spec value. To use this recursively,
wrap all child Keys Specs into Spec Records. See CLJ-2116 for details.
sourceraw docstring

specclj/smacro

(spec pred-or-info)
(spec pred info)

Creates a Spec instance with one or two arguments:

;; using type inference (spec integer?)

;; with explicit type (spec integer? {:type :long})

;; map form (spec {:spec integer?, :type :long})

calls create-spec, see it for details.

Creates a Spec instance with one or two arguments:

;; using type inference
(spec integer?)

;; with explicit type
(spec integer? {:type :long})

;; map form
(spec {:spec integer?, :type :long})

calls `create-spec`, see it for details.
sourceraw docstring

Speccljs

source

spec-descriptionclj/s

(spec-description spec)

Returns a spec description.

Returns a spec description.
sourceraw docstring

spec-nameclj/s

(spec-name spec)

Returns a spec name. Like the private clojure.spec.alpha/spec-name

Returns a spec name. Like the private clojure.spec.alpha/spec-name
sourceraw docstring

spec?clj/s

(spec? x)
source

string-transformerclj/s

source

strip-extra-keys-transformerclj/s

source

Transformerclj/s≠protocol

-decoderclj/s

(-decoder this spec value)

-encoderclj/s

(-encoder this spec value)

-nameclj/s

(-name this)
source

type-transformerclj/s

(type-transformer {transformer-name :name
                   :keys [encoders decoders default-encoder default-decoder]})
source

walkclj/smultimethod

source

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

× close