Skip to content

Commit 896a59d

Browse files
committed
Added dependency CLJS for clj-diff and starting modifications on printer namespace
1 parent ac012b0 commit 896a59d

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

deps.edn

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{:paths ["resources" "src" "test"]
2-
:deps {org.clojure/clojure {:mvn/version "1.10.0"}
2+
:deps {org.clojure/clojure {:mvn/version "1.10.0"}
33
;;mvxcvi/puget {:mvn/version "1.1.2"}
44
github-lambdaisland/puget
55
{:git/url "https://github.com/lambdaisland/puget"
66
:sha "ea860be1f0c6a5e406c45a414802c41e902d010c"}
7-
fipp {:mvn/version "0.6.17"}
8-
org.clojure/core.rrb-vector {:mvn/version "0.0.14"}
9-
tech.droit/clj-diff {:mvn/version "1.0.1"}
10-
mvxcvi/arrangement {:mvn/version "1.2.0"}
11-
com.andrewmcveigh/cljs-time {:mvn/version "0.5.2"}}
7+
fipp {:mvn/version "0.6.17"}
8+
org.clojure/core.rrb-vector {:mvn/version "0.0.14"}
9+
;;tech.droit/clj-diff {:mvn/version "1.0.1"}
10+
org.clojars.rymndhng/clj-diff {:mvn/version "1.1.1-SNAPSHOT"}
11+
mvxcvi/arrangement {:mvn/version "1.2.0"}
12+
com.andrewmcveigh/cljs-time {:mvn/version "0.5.2"}}
1213

1314
:aliases
1415
{:cljs

src/lambdaisland/deep_diff/printer.cljc

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
[puget.printer :as puget]
77
[arrangement.core]
88
[lambdaisland.deep-diff.diff :as diff])
9-
(:import (java.text SimpleDateFormat)
10-
(java.util TimeZone)
11-
(java.sql Timestamp)))
9+
#?(:clj (:import (java.text SimpleDateFormat)
10+
(java.util TimeZone)
11+
(java.sql Timestamp)))
12+
)
1213

1314
(defn print-deletion [printer expr]
1415
(let [no-color (assoc printer :print-color false)]
@@ -40,13 +41,14 @@
4041
(def ^:private ^ThreadLocal thread-local-utc-date-format
4142
(proxy [ThreadLocal] []
4243
(initialValue []
43-
(doto (SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS-00:00")
44-
(.setTimeZone (TimeZone/getTimeZone "GMT"))))))
44+
#?(:clj (doto (SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS-00:00")
45+
(.setTimeZone (TimeZone/getTimeZone "GMT")))
46+
:cljs (doto (cljs-time.format/formatter "yyyy-MM-dd'T'HH:mm:ss.SSS-00:00"))))))
4547

4648
(def ^:private print-date
4749
(puget/tagged-handler
48-
'inst
49-
#(.format ^SimpleDateFormat (.get thread-local-utc-date-format) %)))
50+
'inst
51+
#(.format ^SimpleDateFormat (.get thread-local-utc-date-format) %)))
5052

5153
(def ^:private ^ThreadLocal thread-local-utc-timestamp-format
5254
(proxy [ThreadLocal] []
@@ -56,18 +58,18 @@
5658

5759
(def ^:private print-timestamp
5860
(puget/tagged-handler
59-
'inst
60-
#(str (.format ^SimpleDateFormat (.get thread-local-utc-timestamp-format) %)
61-
(format ".%09d-00:00" (.getNanos ^Timestamp %)))))
61+
'inst
62+
#(str (.format ^SimpleDateFormat (.get thread-local-utc-timestamp-format) %)
63+
(format ".%09d-00:00" (.getNanos ^Timestamp %)))))
6264

6365
(def ^:private print-calendar
6466
(puget/tagged-handler
65-
'inst
66-
#(let [formatted (format "%1$tFT%1$tT.%1$tL%1$tz" %)
67-
offset-minutes (- (.length formatted) 2)]
68-
(str (subs formatted 0 offset-minutes)
69-
":"
70-
(subs formatted offset-minutes)))))
67+
'inst
68+
#(let [formatted (format "%1$tFT%1$tT.%1$tL%1$tz" %)
69+
offset-minutes (- (.length formatted) 2)]
70+
(str (subs formatted 0 offset-minutes)
71+
":"
72+
(subs formatted offset-minutes)))))
7173

7274
(def ^:private print-handlers
7375
{'lambdaisland.deep_diff.diff.Deletion

0 commit comments

Comments
 (0)