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