A Specter path for recursively selecting all the map values in a deeply nested structure. Note that this also matches values within non-map collections.
A Specter path for recursively selecting all the map values in a deeply nested structure. Note that this also matches values within non-map collections.
A Specter path for recursively selecting all the map keys in a deeply nested structure.
A Specter path for recursively selecting all the map keys in a deeply nested structure.
A Specter path for recursively selecting all the map values in a deeply nested structure. This matches maps in non-map collections, but not values in non-map collections.
A Specter path for recursively selecting all the map values in a deeply nested structure. This matches maps in non-map collections, but not values in non-map collections.
A Specter path for recursively selecting all the maps in a deeply nested structure.
A Specter path for recursively selecting all the maps in a deeply nested structure.
(transform-keys f coll)
(transform-keys pred f coll)
(transform-keys pred f mappings coll)
Transform keys in all nested structures recursively. The coll
argument may be a collection or a map. Keys are filtered using the
pred
function, which must take a single argument and return
truthy. If selected, keys are transformed using the f
function,
which must take a single argument and return the replacement value.
A mappings
map argument may be provided, which will used to rename
keys once the f
transformation is complete.
Examples:
user> (morph.core/transform-keys keyword? (comp keyword clojure.string/upper-case name) {:str "some string" "strKey" 99 :vec [1 1 1 1] :top-level-number 8}) {:STR "some string", "strKey" 99, :VEC [1 1 1 1], :TOP-LEVEL-NUMBER 8} user> (morph.core/transform-keys keyword? (comp keyword clojure.string/upper-case name) {:STR :charArray} {:str "some string" "strKey" 99 :vec [1 1 1 1] :top-level-number 8}) {:charArray "some string", "strKey" 99, :VEC [1 1 1 1], :TOP-LEVEL-NUMBER 8} user>
Transform keys in all nested structures recursively. The `coll` argument may be a collection or a map. Keys are filtered using the `pred` function, which must take a single argument and return truthy. If selected, keys are transformed using the `f` function, which must take a single argument and return the replacement value. A `mappings` map argument may be provided, which will used to rename keys once the `f` transformation is complete. Examples: user> (morph.core/transform-keys keyword? (comp keyword clojure.string/upper-case name) {:str "some string" "strKey" 99 :vec [1 1 1 1] :top-level-number 8}) {:STR "some string", "strKey" 99, :VEC [1 1 1 1], :TOP-LEVEL-NUMBER 8} user> (morph.core/transform-keys keyword? (comp keyword clojure.string/upper-case name) {:STR :charArray} {:str "some string" "strKey" 99 :vec [1 1 1 1] :top-level-number 8}) {:charArray "some string", "strKey" 99, :VEC [1 1 1 1], :TOP-LEVEL-NUMBER 8} user>
(transform-vals f coll)
(transform-vals pred f coll)
Transform values in all nested structures recursively. The coll
argument may be a collection or a map. Values are filtered using the
pred
function, which must take a single argument and return
truthy. If selected, keys are transformed using the f
function,
which must take a single argument and return the replacement value.
Example:
user> (->> {:str "some string" :vec [1 1 1 1] :top-level-number 8} (morph.core/transform-vals number? inc) (morph.core/transform-vals string? clojure.string/upper-case)) {:str "SOME STRING", :vec [2 2 2 2], :top-level-number 9}
Transform values in all nested structures recursively. The `coll` argument may be a collection or a map. Values are filtered using the `pred` function, which must take a single argument and return truthy. If selected, keys are transformed using the `f` function, which must take a single argument and return the replacement value. Example: user> (->> {:str "some string" :vec [1 1 1 1] :top-level-number 8} (morph.core/transform-vals number? inc) (morph.core/transform-vals string? clojure.string/upper-case)) {:str "SOME STRING", :vec [2 2 2 2], :top-level-number 9}
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close