Răsfoiți Sursa

chore: dry up usage of same fn across 3 namespaces

Gabriel Horner 2 luni în urmă
părinte
comite
13d7709b34

+ 4 - 4
deps/cli/src/logseq/cli/common/export/common.cljs

@@ -150,8 +150,8 @@
         repetition (if repetition
                      (str " " (repetition-to-string repetition))
                      "")
-        hour (when hour (cli-common-util/zero-pad hour))
-        min  (when min (cli-common-util/zero-pad min))
+        hour (when hour (common-util/zero-pad hour))
+        min  (when min (common-util/zero-pad min))
         time (cond
                (and hour min)
                (common-util/format " %s:%s" hour min)
@@ -162,8 +162,8 @@
     (common-util/format "%s%s-%s-%s %s%s%s%s"
                         open
                         (str year)
-                        (cli-common-util/zero-pad month)
-                        (cli-common-util/zero-pad day)
+                        (common-util/zero-pad month)
+                        (common-util/zero-pad day)
                         wday
                         time
                         repetition

+ 0 - 6
deps/cli/src/logseq/cli/common/util.cljc

@@ -18,12 +18,6 @@
                   content)))
        zip)))
 
-(defn zero-pad
-  [n]
-  (if (< n 10)
-    (str "0" n)
-    (str n)))
-
 ;; Macros are defined at top-level for frontend and nbb
 
 (defmacro concatv

+ 0 - 1
deps/common/src/logseq/common/util.cljs

@@ -113,7 +113,6 @@
       (js->clj :keywordize-keys true)))
 
 (defn zero-pad
-  "Copy of frontend.util/zero-pad. Too basic to couple to main app"
   [n]
   (if (< n 10)
     (str "0" n)

+ 1 - 5
src/main/frontend/util.cljc

@@ -257,11 +257,7 @@
                            (.then #(on-ok %)))
                        (on-failed resp)))))))))
 
-(defn zero-pad
-  [n]
-  (if (< n 10)
-    (str "0" n)
-    (str n)))
+#?(:cljs (def zero-pad common-util/zero-pad))
 
 #?(:cljs
    (defn safe-parse-int