Skip to content

Commit

Permalink
contrib.str - fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ggeoffrey committed Aug 9, 2024
1 parent ae982c9 commit 2ac365d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/contrib/element_syntax.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
{:props {:placeholder "Type a message"}
:on-keydown (e/fn [e]
(when (= "Enter" (.-key e))
(when-some [v (contrib.str/empty->nil (-> e .-target .-value))]
(when-some [v (not-empty (-> e .-target .-value))]
(dom/style {:background-color "yellow"})
(e/server (swap! !msgs #(cons {::username username ::msg v} (take 9 %))))
(set! (.-value dom/node) ""))))}))
Expand Down
4 changes: 2 additions & 2 deletions src/contrib/str.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
(any-matches? ["abc"] "d") := nil)


(defn ^{:deprecated "Use clojure.core/empty?"} empty? [s]
(defn ^:deprecated empty? "Deprecated. Use clojure.core/empty?" [s]
(or (and (string? s) (zero? (count s)))
(nil? s)))

Expand All @@ -73,7 +73,7 @@
(clojure.core/empty? " ") := false
)

(defn ^{:deprecated "Use clojure.core/not-empty"} empty->nil [s] (if (empty? s) nil s))
(defn ^:deprecated empty->nil "Deprecated. Use clojure.core/not-empty" [s] (if (clojure.core/empty? s) nil s))

(tests
(empty->nil nil) := nil
Expand Down
2 changes: 1 addition & 1 deletion src/hyperfiddle/electric_ui4.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ can be pending."

#?(:cljs (defn ?read-line! [node e]
(let [line (.-value node)]
(when (and (= "Enter" (.-key e)) (contrib.str/empty->nil line))
(when (and (= "Enter" (.-key e)) (not-empty line))
(set! (.-value node) "") line))))

(defmacro on-submit
Expand Down

0 comments on commit 2ac365d

Please sign in to comment.