(append-if m k v)
Appends v
to the value of k
. If k
does not exist in m
,
k [v]
is assoced. If k
does exist in m
, v
is conjed.
Example:
(append-if {:Value [1 2 3]} :Value 4)
;; {:Value [1 2 3 4]}
Appends `v` to the value of `k`. If `k` does not exist in `m`, `k [v]` is assoced. If `k` does exist in `m`, `v` is conjed. Example: ```clojure (append-if {:Value [1 2 3]} :Value 4) ;; {:Value [1 2 3 4]} ```
(ensure-vec v)
Ensures that v
is a vector.
Example:
(ensure-vec nil) ;!
;; nil
(ensure-vec 1)
;; [1]
(ensure-vec [1])
;; [1]
Ensures that `v` is a vector. Example: ```clojure (ensure-vec nil) ;! ;; nil (ensure-vec 1) ;; [1] (ensure-vec [1]) ;; [1] ```
(path->kw-vec s)
Turns the path into a vector of keywords.
Example:
(path->kw-vec "a.b.c")
;; [:a :b :c]
Turns the path into a vector of keywords. Example: ```clojure (path->kw-vec "a.b.c") ;; [:a :b :c] ```
(replace-if m k v)
Replaces v
alue of k
ey in struct if v
is not nil
.
Example:
(replace-if {:Type "a"} :Type "b")
;; {:Type "b"}
Replaces `v`alue of `k`ey in struct if `v`is not `nil`. Example: ```clojure (replace-if {:Type "a"} :Type "b") ;; {:Type "b"} ```
(vector-if m kw)
Makes the value v
behind the keyword kw
a vector if v
is not
nil.
Makes the value `v` behind the keyword `kw` a vector if `v` is not nil.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close