(defn partial-namespace-matcher
"Creates a tester that whitelists all functions within a namespace and all namespaces under it."
[& namespaces]
(fn [form]
(cond
(= (type form) clojure.lang.Var)
(let [ns (str (ns-name (:ns (meta form))))]
(map #(zero? (.indexOf ns (str %))) namespaces))
(= (type form) java.lang.Class)
(let [ns (second (re-find #"^class (.*)\.\w+$" (str form)))]
(map #(zero? (.indexOf ns (str %))) namespaces))
true
'())))
Comments top
No comments for partial-namespace-matcher. Log in to add a comment.