Liking cljdoc? Tell your friends :D

vl-data-insert.utils


append-ifclj

(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]}
```
sourceraw docstring

ensure-vecclj

(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]
```
sourceraw docstring

path->kw-vecclj

(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]
```
sourceraw docstring

replace-ifclj

(replace-if m k v)

Replaces value of key in struct if vis 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"}
```
sourceraw docstring

vector-ifclj

(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.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close