Liking cljdoc? Tell your friends :D

bouncer.validators

This namespace contains all built-in validators as well as macros for defining new validators and validator sets

This namespace contains all built-in validators as well as
macros for defining new validators and validator sets
raw docstring

booleanclj/s

source

customclj/s

source

datetimeclj/s

source

defvalidatorclj/s≠macro

clj
(defvalidator name docstring? opts-map? [args*] & body)
cljs
(defvalidator &form &env name & options)

Defines a new validating function using args & body semantics as provided by "defn". docstring and opts-map are optional

opts-map is a map of key-value pairs and may be one of:

  • :default-message-format used when the client of this validator doesn't provide a message (consider using custom message functions)

  • :optional whether the validation should be run only if the given key has a non-nil value in the map. Defaults to true.

or any other key-value pair which will be available in the validation result under the :metadata key.

The function will be called with the value being validated as its first argument.

Any extra arguments will be passed along to the function in the order they were used in the "validate" call.

e.g.:

(defvalidator member [value coll] (some #{value} coll))

(validate {:age 10} :age [[member (range 5)]])

This means the validator member will be called with the arguments 10 and (0 1 2 3 4), in that order.

Defines a new validating function using args & body semantics as provided by "defn".
docstring and opts-map are optional

opts-map is a map of key-value pairs and may be one of:

- `:default-message-format` used when the client of this validator doesn't
provide a message (consider using custom message functions)

- `:optional` whether the validation should be run only if the given key has
a non-nil value in the map. Defaults to true.

or any other key-value pair which will be available in the validation result
under the `:metadata` key.

The function will be called with the value being validated as its first argument.

Any extra arguments will be passed along to the function in the order they were used in the
"validate" call.

e.g.:


  (defvalidator member
    [value coll]
    (some #{value} coll))

  (validate {:age 10}
    :age [[member (range 5)]])


This means the validator `member` will be called with the arguments `10` and `(0 1 2 3 4)`,
in that order.
source (clj)source (cljs)raw docstring

emailclj/s

source

everyclj/s

source

in-rangeclj/s

source

integerclj/s

source

matchesclj/s

source

max-countclj/s

source

memberclj/s

source

min-countclj/s

source

numberclj/s

source

positiveclj/s

source

requiredclj/s

source

stringclj/s

source

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

× close