cljs.spec.alpha
&
takes a regex op re, and predicates. Returns a regex-op that consumes input as per re but subjects the resulting value t...
macro([re & preds])
*
Returns a regex op that matches zero or more values matching pred. Produces a vector of matches iff there is at least on...
macro([pred-form])
- value
- value
If true, compiler will enable spec asserts, which are then subject to runtime control via check-asserts? If false, compi...
value- value
- value
- value
+
Returns a regex op that matches one or more values matching pred. Produces a vector of matches
macro([pred-form])
?
Returns a regex op that matches zero or one value matching pred. Produces a single value (not a collection) if matched.
macro([pred-form])
A
- function
([form])
Takes key+pred pairs, e.g. (s/alt :even even? :small #(< % 42)) Returns a regex op that returns a map entry containing...
macro([& key-pred-forms])
Takes predicate/spec-forms, e.g. (s/and even? #(< % 42)) Returns a spec that returns the conformed value. Successive c...
macro([& pred-forms])
spec-checking assert expression. Returns x if x is valid? according to spec, else throws an error with explain-data plus...
macro([spec x])
Do not call this directly, use 'assert'.
function([spec x])
C
Takes key+pred pairs, e.g. (s/cat :e even? :o odd?) Returns a regex op that matches (all) values in sequence, returnin...
macro([& key-pred-forms])
Enable or disable spec asserts that have been compiled with '*compile-asserts*' true. See 'assert'. Initially set to bo...
function([flag])
Returns the value set by check-asserts.
function([])
Returns a spec for a collection of items satisfying pred. Unlike generator will fill an empty init-coll. Same options a...
macro([pred & opts])
Given a spec and a value, returns :cljs.spec.alpha/invalid if value does not match spec, else the (possibly destructured...
function([spec x])
takes a predicate function with the semantics of conform i.e. it should return either a (possibly converted) value or :c...
macro([f] [f unf])
D
Given a namespace-qualified keyword or resolveable symbol k, and a spec, spec-name, predicate or regex-op makes an entry...
macro([k spec-form])
returns an abbreviated description of the spec as data
function([spec])
Specs a 64-bit floating point number. Options: :infinite? - whether +/- infinity allowed (default true) :NaN? - ...
macro([& {:keys [infinite? NaN? min max], :or {infinite? true, NaN? true}, :as m}])
E
takes a pred and validates collection elements against that pred. Note that 'every' does not do exhaustive checking, ra...
macro([pred & {:keys [into kind count max-count min-count distinct gen-max gen-into gen], :as opts}])
like 'every' but takes separate key and val preds and works on associative collections. Same options as 'every', :into ...
macro([kpred vpred & opts])
generates a number (default 10) of values compatible with spec and maps conform over them, returning a sequence of [val ...
function([spec] [spec n] [spec n overrides])
exercises the fn named by sym (a symbol) by applying it to n (default 10) generated samples of its args spec. When fspec...
macro([sym] [sym n] [sym n fspec])
Given a spec and a value that fails to conform, prints an explanation to *out*.
function([spec x])
Given a spec and a value x which ought to conform, returns nil if x conforms, else a map with at least the key ::problem...
function([spec x])
- function
([spec path via in x])
Prints explanation data (per 'explain-data') to *out* using the printer in *explain-out*, by default explain-printer.
function([ed])
Default printer for explain-data. nil indicates a successful validation.
function([ed])
Given a spec and a value that fails to conform, returns an explanation as a string.
function([spec x])
F
Takes a symbol naming a function, and one or more of the following: :args A regex spec for the function arguments as th...
macro([fn-sym & specs])
- function
([f-n])
returns the spec as data
function([spec])
takes :args :ret and (optional) :fn kwargs whose values are preds and returns a spec whose conform/explain take a fn and...
macro([& {:keys [args ret fn gen], :or {ret (quote cljs.core/any?)}}])
G
I
Returns a spec that validates insts in the range from start (inclusive) to end (exclusive).
macro([start end])
Return true if inst at or after start and before end
function([start end inst])
Returns a spec that validates fixed precision integers in the range from start (inclusive) to end (exclusive).
macro([start end])
Return true if start <= val, val < end and val is a fixed precision integer.
function([start end val])
tests the validity of a conform return value
function([ret])
K
Creates and returns a map validating spec. :req and :opt are both vectors of namespaced-qualified keywords. The validato...
macro([& {:keys [req req-un opt opt-un gen]}])
takes the same arguments as spec/keys and returns a regex op that matches sequences of key/values, converts them into a ...
macro([& kspecs])
M
- value
Returns a spec for a map whose keys satisfy kpred and vals satisfy vpred. Unlike 'every-kv', map-of will exhaustively co...
macro([kpred vpred & opts])
Takes map-validating specs (e.g. 'keys' specs) and returns a spec that returns a conformed map satisfying all of the spe...
macro([& pred-forms])
Takes the name of a spec/predicate-returning multimethod and a tag-restoring keyword or fn (retag). Returns a spec that...
macro([mm retag])
N
returns a spec that accepts nil and values satisfiying pred
macro([pred])
takes a spec and returns a spec that has the same properties except 'conform' returns the original (not the conformed) v...
function([spec])
O
Takes key+pred pairs, e.g. (s/or :even even? :small #(< % 42)) Returns a destructuring spec that returns a map entry c...
macro([& key-pred-forms])
R
S
T
takes one or more preds and returns a spec for a tuple, a vector where each element conforms to the corresponding pred. ...
macro([& preds])
U
Given a spec and a value created by or compliant with a call to 'conform' with the same spec, returns a value with all c...
function([spec x])
V
Helper function that returns true when x is valid for spec.
function([spec x] [spec x form])
W
Takes a spec and a no-arg, generator-returning fn and returns a version of that spec that uses that generator
function([spec gen-fn])