partial-namespace-matcher

net.licenser.sandbox.matcher

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

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:32 top

(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
      '())))
Vars in net.licenser.sandbox.matcher/partial-namespace-matcher: = cond defn fn let map ns str type zero?
Used in 0 other vars

Comments top

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