Liking cljdoc? Tell your friends :D

flathead.flatten


flat->treeclj

(flat->tree separator row)

Transforms a flat associative array (map) to a nested structure so that all values are associated to a new nested or existing map using a specific key path, which is generated from the current key of the value.

A key path is a sequence of keys and it is generated from splitting the current key using a given separator. Separator is a regular expression.

e.g. {:a_x 1, :a_y 2 :b 3} -> {a: {:x 1 :y 2} :b 3}

Transforms a flat associative array (map) to a nested structure so that all values
are associated to a new nested or existing map using a specific key path, which is generated from
the current key of the value.

A key path is a sequence of keys and it is generated from splitting the current key
using a given separator. Separator is a regular expression.

e.g. {:a_x 1, :a_y 2 :b 3} -> {a: {:x 1 :y 2} :b 3}
sourceraw docstring

key-pathclj

(key-path key separator)

Split key to a key path. Key path item separator is separator regular expression.

Split key to a key path. Key path item separator is separator regular expression.
sourceraw docstring

sequence->mapclj

(sequence->map object)
(sequence->map structural-sequence? object)

When other sequences are part of the nested structure they can be first converted to maps and then to flat objects using function tree->flat.

Some other libraries e.g. ramda treat all sequences automatically as maps. Whereas in clojure.core maps are sequences, but other sequences (e.g. lists and vectors) are not maps.

This function can convert all seqable objects to a map where key is values index in the sequence. Nils will be kept as nils.

A predicate function structural-sequence? can be used to define which sequences are part of the structure.

For example strings are seqable but they typically are not part of the nested structure.

When other sequences are part of the nested structure they can be first converted to maps
and then to flat objects using function tree->flat.

Some other libraries e.g. ramda treat all sequences automatically as maps.
Whereas in clojure.core maps are sequences, but other sequences (e.g. lists and vectors) are not maps.

This function can convert all seqable objects to a map where key is values index in the sequence. Nils will be kept as nils.

A predicate function structural-sequence? can be used to define which sequences are
part of the structure.

For example strings are seqable but they typically are not part of the nested structure. 
sourceraw docstring

tree->flatclj

(tree->flat separator object)
(tree->flat prefix separator object)

Transforms a nested associative array (map) to a flat one. This is an inverse of the flat->tree function.

The nested structure is not allowed to contain cycles it must be a tree.

If nested structure contains also other sequences they can be first converted to map using function sequence->map

Transforms a nested associative array (map) to a flat one.
This is an inverse of the flat->tree function.

The nested structure is not allowed to contain cycles it must be a tree.

If nested structure contains also other sequences
they can be first converted to map using function sequence->map
sourceraw docstring

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

× close