examine.constraints

Functions that yield constraints and a set of default constraints.

for-each

(for-each f)
Returns constraint-fn that applies constraint-fn f to cartesian
product of collections.

from-pred

(from-pred pred message)
Takes a predicate and a message and returns a constraint.

has-items

Constraint-fn that passes if collection is not empty.

in-range

(in-range min max)
Returns constraint-fn that passes if number is at
least min, at most max.

is-boolean

(is-boolean x)
Constraint-fn that passes if value is true or false.

is-date

is-integer

Constraint-fn that passes if value is an integer.

is-number

Constraint-fn that passes if value is a number.

is-string

Constraint-fn that passes if value is a string.

matches-re

(matches-re re)
Returns constraint-fn that passes if string matches
regular expression re.

max-length

(max-length n)
Returns constraint-fn that passes if collection or
string has at most n items/characters.

min-le-max

Constraint-fn that passes if first arg is not greater than second arg.

min-length

(min-length n)
Returns constraint-fn that passes if collection or
string has at least n items/characters.

no-exception

(no-exception f)
Takes a function with arbitrary number of arguments and returns
a constraint that returns the exception message text if any is thrown.

not-blank?

Returns true if value is not nil and not an empty string

not-nil?

Returns true if value is not nil.

of-type?

(of-type? typenames x)

one-of

(one-of & values)
Returns constraint-fn that passes if value is one
of the specified values.

required

Constraint-fn that passes if value is not nil.