vl-data-insert.utils
append-if
(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: ```clojure (append-if {:Value [1 2 3]} :Value 4) ;; {:Value [1 2 3 4]} ```
check-kw
(check-kw m kw)
ensure-map
(ensure-map x v)
Ensures `x`to be a map. If `x` is a value a map is constucted from the last keyword and the value. Example: ```clojure (ensure-map 10 [:a :b :c]) ;; => ;; [{:c 10} [:a :b]] (ensure-map {:d 10} [:a :b :c]) ;; => ;; [{:d 10} [:a :b :c]] ```
ensure-vec
(ensure-vec v)
Ensures that `v` is a vector even if `v` is `nil`. Example: ```clojure ;; important: (ensure-vec nil) ;;=> [nil] ;; ^^ because: (concat [1 2] nil) ;; => (1 2) ; but we need: (concat [1 2] [nil]) ;; => (1 2 nil) ;; to ensure that all ;; Value-vectors keep the same length (ensure-vec 1) ;; [1] (ensure-vec [1]) ;; [1] ```
path->kw-vec
(path->kw-vec s)
Turns the path into a vector of keywords. Example: ```clojure (path->kw-vec "a.b.c") ;; [:a :b :c] ```
replace-if
(replace-if m k v)
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
(vector-if m kw)
Makes the value `v` of keyword `kw` a vector also if `v` is `nil`.