From 22eb854f6523f526f012a18191dbdf147be416f4 Mon Sep 17 00:00:00 2001 From: Geoffrey Gaillard Date: Thu, 8 Aug 2024 17:13:58 +0200 Subject: [PATCH] Deprecate redundant contrib.str fns --- src/contrib/str.cljc | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/contrib/str.cljc b/src/contrib/str.cljc index 7f80d5c44..48f3e3c1c 100644 --- a/src/contrib/str.cljc +++ b/src/contrib/str.cljc @@ -60,21 +60,31 @@ (any-matches? ["abc"] "d") := nil) -(defn empty? [s] (or (and (string? s) (zero? (count s))) - (nil? s))) +(defn ^{:deprecated "Use clojure.core/empty?"} empty? [s] + (or (and (string? s) (zero? (count s))) + (nil? s))) (tests - (empty? "") := true - (empty? nil) := true - (empty? " ") := false) + (empty? "") := true + (clojure.core/empty? "") := true + (empty? nil) := true + (clojure.core/empty? nil) := true + (empty? " ") := false + (clojure.core/empty? " ") := false + ) -(defn empty->nil [s] (if (empty? s) nil s)) +(defn ^{:deprecated "Use clojure.core/not-empty"} empty->nil [s] (if (empty? s) nil s)) (tests - (empty->nil nil) := nil - (empty->nil "") := nil - (empty->nil " ") := " " - (empty->nil "a") := "a") + (empty->nil nil) := nil + (clojure.core/not-empty nil) := nil + (empty->nil "") := nil + (clojure.core/not-empty "") := nil + (empty->nil " ") := " " + (clojure.core/not-empty " ") := " " + (empty->nil "a") := "a" + (clojure.core/not-empty "a") := "a" + ) (defn blank->nil "Nullify empty strings, identity on all other values." [s] (if-not (string? s)