(identity f msg)
Creates a validator that produces a msg when the value does not equal the result of passing the value through the identity function. Does not validate nil.
(identity sort "must be sorted")
Creates a validator that produces a msg when the value does not equal the result of passing the value through the identity function. Does not validate nil. (identity sort "must be sorted")
(ifn->fn ifn)
Deprecated. Use ::ifn metadata instead.
Utility wrapper for maps when you want to use them as a transforming function because make-transformer treats maps as nested transformations.
Deprecated. Use ::ifn metadata instead. Utility wrapper for maps when you want to use them as a transforming function because make-transformer treats maps as nested transformations.
(make-transformer config)
Deprecated. Use transformer
instead.
Deprecated. Use `transformer` instead.
(make-validator config)
Deprecated. Use validator
instead.
Deprecated. Use `validator` instead.
(matches re msg)
Creates a validator that produces a msg when the value does not match a given regular expression or the value is not a string. Does not validate nil.
(matches #"[0-9]{4,}" "at least 4 digits")
Creates a validator that produces a msg when the value does not match a given regular expression or the value is not a string. Does not validate nil. (matches #"[0-9]{4,}" "at least 4 digits")
(max-length n msg)
Creates a validator that produces a msg when the length of the value is not at least what is specified. Does not validate nil.
(max-length 10 "must be at most 10")
Creates a validator that produces a msg when the length of the value is not at least what is specified. Does not validate nil. (max-length 10 "must be at most 10")
(min-length n msg)
Creates a validator that produces a msg when the length of the value is not at least what is specified. Does not validate nil.
(min-length 10 "must be at least 10")
Creates a validator that produces a msg when the length of the value is not at least what is specified. Does not validate nil. (min-length 10 "must be at least 10")
(pred p msg)
Creates a validator that produces a msg when a value does not satisfy the predicate. Does not validate nil.
(pred string? "needs to be a string")
Creates a validator that produces a msg when a value does not satisfy the predicate. Does not validate nil. (pred string? "needs to be a string")
(required msg)
Creates a validator that produces a msg when a value is nil.
(required "this is required")
Creates a validator that produces a msg when a value is nil. (required "this is required")
(transformer config)
Creates a transforming function that transforms a value through a data config.
(transformer {:person {:email string/lower-case :attributes ^::map-of {keyword str}}})
Creates a transforming function that transforms a value through a data config. (transformer {:person {:email string/lower-case :attributes ^::map-of {keyword str}}})
(validator config)
Create a validating function from a configuration.
(validator {:a (pred number? "must be a number") :b (required "required")}
Create a validating function from a configuration. (validator {:a (pred number? "must be a number") :b (required "required")}
(validator-coll config)
Deprecated. Use ::coll-of metadata instead.
(validator ^::coll-of [[(required "required") (pred string? "string")]])
Deprecated. Use ::coll-of metadata instead. (validator ^::coll-of [[(required "required") (pred string? "string")]])
(validator-map key-config val-config)
Deprecated. Use ::map-of metadata instead.
(validator ^::map-of {[(required "required") (pred keyword? "keyword")] val-validator})
Deprecated. Use ::map-of metadata instead. (validator ^::map-of {[(required "required") (pred keyword? "keyword")] val-validator})
(validator-tuple & configs)
Deprecated. Use ::tuple-of metadata instead.
(validator ^::tuple-of [(pred number? "number") [(required "required") (matches #"[0-9]{4,}" "digits")]])
Deprecated. Use ::tuple-of metadata instead. (validator ^::tuple-of [(pred number? "number") [(required "required") (matches #"[0-9]{4,}" "digits")]])
(when-somep p)
Utility wrapper for transforming functions that you only want called when the value is not nil (i.e. not required).
(make-transformer {:something [(when-somep string/trim) (when-somep string/upper-case)]})
Utility wrapper for transforming functions that you only want called when the value is not nil (i.e. not required). (make-transformer {:something [(when-somep string/trim) (when-somep string/upper-case)]})
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close