namespace-matcher

net.licenser.sandbox.matcher

  • (namespace-matcher & namespaces)
Creates a tester that whitelists all functions within a namespace.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source net/licenser/sandbox/matcher.clj:11 top

(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
      '())))
Vars in net.licenser.sandbox.matcher/namespace-matcher: = cond defn fn map meta ns-name partial re-find second str symbol type
Used in 0 other vars

Comments top

No comments for namespace-matcher. Log in to add a comment.