cljs.spec.alpha
*compile-asserts*
If true, compiler will enable spec asserts, which are then
subject to runtime control via check-asserts? If false, compiler
will eliminate all spec assert overhead. See 'assert'.
Initially set to the negation of the ':elide-asserts' compiler option.
Defaults to true.
(check-asserts flag)
Enable or disable spec asserts that have been compiled
with '*compile-asserts*' true. See 'assert'.
Initially set to boolean value of cljs.spec.alpha/*runtime-asserts*.
Defaults to false.
(conform spec x)
Given a spec and a value, returns :cljs.spec.alpha/invalid if value does
not match spec, else the (possibly destructured) value.
(explain spec x)
Given a spec and a value that fails to conform, prints an explanation to *out*.
(explain-data 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 ::problems whose value is
a collection of problem-maps, where problem-map has at least :path :pred and :val
keys describing the predicate and the value that failed at that
path.
(explain-out ed)
Prints explanation data (per 'explain-data') to *out* using the printer in *explain-out*,
by default explain-printer.
(explain-str spec x)
Given a spec and a value that fails to conform, returns an explanation as a string.
(gen spec)
(gen spec overrides)
Given a spec, returns the generator for it, or throws if none can
be constructed. Optionally an overrides map can be provided which
should map spec names or paths (vectors of keywords) to no-arg
generator-creating fns. These will be used instead of the generators at those
names/paths. Note that parent generator (in the spec or overrides
map) will supersede those of any subtrees. A generator for a regex
op must always return a sequential collection (i.e. a generator for
s/? should return either an empty sequence/vector or a
sequence/vector with one item in it)
(get-spec k)
Returns spec registered for keyword/symbol/var k, or nil.
(nonconforming spec)
takes a spec and returns a spec that has the same properties except
'conform' returns the original (not the conformed) value. Note, will specize regex ops.
(regex? x)
returns x if x is a (cljs.spec.alpha) regex op, else logical false
(registry)
returns the registry map, prefer 'get-spec' to lookup a spec by name
(spec? x)
returns x if x is a spec object, else logical false
(unform spec x)
Given a spec and a value created by or compliant with a call to
'conform' with the same spec, returns a value with all conform
destructuring undone.
(with-gen spec gen-fn)
Takes a spec and a no-arg, generator-returning fn and returns a version of that spec that uses that generator