From 2008322368882308e5e1643fbf3bff10325cea7d Mon Sep 17 00:00:00 2001 From: bom Date: Fri, 17 May 2024 15:49:31 +0200 Subject: [PATCH] Deprecate replace-all-matching-values-by-new-value in favor or 'replace-all-matching' as it is shorter --- src/main/cljc/dda/c4k_common/common.cljc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/cljc/dda/c4k_common/common.cljc b/src/main/cljc/dda/c4k_common/common.cljc index 0f902e4..3fb2f43 100644 --- a/src/main/cljc/dda/c4k_common/common.cljc +++ b/src/main/cljc/dda/c4k_common/common.cljc @@ -42,16 +42,24 @@ %) coll)) -(defn-spec replace-all-matching-values-by-new-value cp/map-or-seq? +(defn-spec replace-all-matching cp/map-or-seq? [coll cp/map-or-seq? - value-to-match string? - value-to-replace cp/str-or-number?] - (clojure.walk/postwalk #(if (and (= (type value-to-match) (type %)) + match-value string? + replace-value cp/str-or-number?] + (clojure.walk/postwalk #(if (and (= (type value-to-match) (type %)) (= value-to-match %)) value-to-replace - %) + %) coll)) + +(defn-spec ^{:deprecated "6.2.4"} replace-all-matching-values-by-new-value cp/map-or-seq? + "Use replace-all-matching instead" + [coll cp/map-or-seq? + value-to-match string? + value-to-replace cp/str-or-number?] + (replace-all-matching coll value-to-match value-to-replace)) + (defn-spec concat-vec vector? [& vs (s/* cp/string-sequence?)] (into []