Liking cljdoc? Tell your friends :D

hara.data.pipeline.base.type-check


wrap-single-type-checkclj

(wrap-single-type-check f)

wraps normalise to type check inputs as well as to coerce incorrect inputs (pipeline/normalise {:account {:age "10"}} {:schema (schema/schema examples/account-name-age-sex)} {:normalise-single [wrap-single-type-check]}) => (throws-info {:type :long, :data "10", :wrong-type true})

(pipeline/normalise {:account {:age "10"}} {:schema (schema/schema examples/account-name-age-sex) :options {:use-coerce true}} {:normalise-single [wrap-single-type-check]}) => {:account {:age 10}}

wraps normalise to type check inputs as well as to coerce incorrect inputs
(pipeline/normalise {:account {:age "10"}}
                     {:schema (schema/schema examples/account-name-age-sex)}
                     {:normalise-single [wrap-single-type-check]})
=> (throws-info {:type :long,
                 :data "10",
                 :wrong-type true})

(pipeline/normalise {:account {:age "10"}}
                     {:schema (schema/schema examples/account-name-age-sex)
                      :options {:use-coerce true}}
                     {:normalise-single [wrap-single-type-check]})
=> {:account {:age 10}}
raw docstring

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

× close