Fns applicable to both jvm and js
Fns applicable to both jvm and js
(assoc-in+ m & path-vals)Similar to assoc-in except can specify multiple kv pairs
Similar to assoc-in except can specify multiple kv pairs
(assoc-some m k v)(assoc-some m k v & kvs)Associate a key k to map m if v is not nil.
Associate a key `k` to map `m` if `v` is not nil.
(camel-case-keys m)Camel case all keys in map m.
Camel case all keys in map m.
(camel-case-keyword x)Namespace is omitted in returned value.
Namespace is omitted in returned value.
(conform-map map kmap)select-keys on map with keys from kmap and renamed keys to be from kmap.
select-keys on map with keys from kmap and renamed keys to be from kmap.
(deep-merge a b)Deep merge a data structure. Taken from http://stackoverflow.com/questions/17327733/merge-two-complex-data-structures
Deep merge a data structure. Taken from http://stackoverflow.com/questions/17327733/merge-two-complex-data-structures
(dissoc-in m [k & ks :as keys])Dissociates an entry from a nested associative structure returning a new nested structure. keys is a sequence of keys. Any empty maps that result will not be present in the new structure.
Dissociates an entry from a nested associative structure returning a new nested structure. keys is a sequence of keys. Any empty maps that result will not be present in the new structure.
(elide-paths* coll & paths)paths is a collection of vectors that can be used to navigate a collection. Each path must be a non empty vector otherwise that path is skipped.
paths is a collection of vectors that can be used to navigate a collection. Each path must be a non empty vector otherwise that path is skipped.
(elide-vals key-set m)(elide-vals elision-value key-set m)Walks the map eliding the values whose key appears in key-set.
Walks the map eliding the values whose key appears in key-set.
(filter-keys pred m)Apply pred a one arity function to each map key and
include the map entry if pred returns truthy.
Apply `pred` a one arity function to each map key and include the map entry if `pred` returns truthy.
(filter-kv pred m)Apply pred a two arity function to each map entry
and include the map entry if pred returns truthy.
Apply `pred` a two arity function to each map entry and include the map entry if `pred` returns truthy.
(filter-vals pred m)Apply pred a one arity function to each map val and
include the map entry if pred returns truthy.
Apply `pred` a one arity function to each map val and include the map entry if `pred` returns truthy.
(group-by+ key-fn val-fn xs)(group-by+ key-fn val-fn val-agg-fn xs)Similar to group by, but allows applying val-fn to each item in the grouped by list of each key. Can also apply val-agg-fn to the result of mapping val-fn. All input fns are 1 arity. If val-fn and val-agg-fn were the identity fn then this behaves the same as group-by.
Similar to group by, but allows applying val-fn to each item in the grouped by list of each key. Can also apply val-agg-fn to the result of mapping val-fn. All input fns are 1 arity. If val-fn and val-agg-fn were the identity fn then this behaves the same as group-by.
(intersect-with f map-1 map-2)Returns a map whose keys exist in boty map-1 and map-2. f is a 2 arity function that is invoked wht the value from map-1 and map-2 respectively for each matching key.
Returns a map whose keys exist in boty map-1 and map-2. f is a 2 arity function that is invoked wht the value from map-1 and map-2 respectively for each matching key.
(key= k v)Returns a predicate that takes a map as an argument. The predicate applies k to the map and does an equality check against v.
Returns a predicate that takes a map as an argument. The predicate applies k to the map and does an equality check against v.
(lisp-case-keys m)Lisp case all keys in map m.
Lisp case all keys in map m.
(lisp-case-keyword x)Turns :helloHow to :hello-how Namespace is omitted in returned value.
Turns :helloHow to :hello-how Namespace is omitted in returned value.
(map-keys f m)Applies a function f to each key in map m.
This is shallow, it does not walk m.
Applies a function `f` to each key in map `m`. This is shallow, it does not walk `m`.
(map-kv f m)Apply f a two arity function to each
map entry in m.
Apply `f` a two arity function to each map entry in `m`.
(map-vals f m)Applies a function f to each value in map m.
This is shallow, it does not walk m.
Applies a function `f` to each value in map `m`. This is shallow, it does not walk `m`.
(prune-map m)(prune-map m pred)Prunes the map according to pred
Prunes the map according to `pred`
(unqualify x)Unqualifies a keyword or symbol. Given :hello/world => :world. Given 'hello/world returns 'world.
Unqualifies a keyword or symbol. Given :hello/world => :world. Given 'hello/world returns 'world.
(walk kv-fn m)(walk key-fn val-fn m)Adapted from clojure.walk/keywordize-keys. Uses walk/postwalk
and calls key-fn on each key and val-fn on each value
for each map entry. The 2 arity version invokes kv-fn
for each map entry. Recursively changes all keys and values
as specified by kv-fn or key-fn and val-fn.
Adapted from clojure.walk/keywordize-keys. Uses `walk/postwalk` and calls `key-fn` on each key and `val-fn` on each value for each map entry. The 2 arity version invokes `kv-fn` for each map entry. Recursively changes all keys and values as specified by `kv-fn` or `key-fn` and `val-fn`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |