Skip to content

Commit

Permalink
Promote number? and integer? to core ns
Browse files Browse the repository at this point in the history
  • Loading branch information
malcolmsparks committed Jun 13, 2019
1 parent c20d099 commit 306a53f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
12 changes: 11 additions & 1 deletion src/juxt/jsonschema/core.clj
@@ -1,4 +1,14 @@
(ns juxt.jsonschema.core)
(ns juxt.jsonschema.core
(:refer-clojure :exclude [number? integer?]))

(defn number? [x]
(clojure.core/number? x))

(defn integer? [x]
(or
(clojure.core/integer? x)
(when (number? x)
(zero? (mod x 1)))))

(defn array? [x]
(sequential? x))
Expand Down
11 changes: 1 addition & 10 deletions src/juxt/jsonschema/validate.cljc
Expand Up @@ -9,7 +9,7 @@
[clojure.java.io :as io] ;; TODO: Support cljs
[clojure.test :refer [deftest is are]]
[juxt.jsonschema.jsonpointer :as jsonpointer]
[juxt.jsonschema.core :refer [array? object? schema?]]
[juxt.jsonschema.core :refer [number? integer? array? object? schema?]]
[juxt.jsonschema.schema :as schema]
[juxt.jsonschema.resolve :as resolv]
[juxt.jsonschema.regex :as regex]
Expand Down Expand Up @@ -83,15 +83,6 @@
;; TODO: These must check against JavaScript primitive types,
;; not Clojure/Java ones

(defn number? [x]
(clojure.core/number? x))

(defn integer? [x]
(or
(clojure.core/integer? x)
(when (number? x)
(zero? (mod x 1)))))

(def type-preds
{"null" nil?
"boolean" boolean?
Expand Down

0 comments on commit 306a53f

Please sign in to comment.