Liking cljdoc? Tell your friends :D

flathead.flatten


conj-keyclj/s

(conj-key root-key separator key)

Add a prefix to a key. Returns a new key with specified prefix. If the prefix is nil then the original key is returned.

Add a prefix to a key. Returns a new key with specified prefix.
If the prefix is nil then the original key is returned.
sourceraw docstring

flat->treeclj/s

(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-nameclj/s

(key-name key)
source

key-pathclj/s

(key-path separator key)

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

tree->flatclj/s

(tree->flat separator tree)
(tree->flat root-key separator tree)
(tree->flat root-key branch? separator tree)

Transforms a nested associative structure to a flat one. The flat key is created by concatenating the child key to the object root key using the given separator. This is an inverse of the flat->tree function. This is based on deep/tree->flat (see deep/tree->flat). Supports any seqable objects (see seqable?). Other sequences are transformed to maps using plain/sequence->map.

Arguments:

  • separator - A separator string used to form the flat map keys.
  • tree - A tree object is converted to a flat representation
  • root-key - Root key defines the root key for the tree object - use nil for empty
  • branch? - A branch? predicate can be used to mark objects as part of tree structure and not a value see deep/tree->flat. The default implementation will branch only inside maps.
Transforms a nested associative structure to a flat one.
The flat key is created by concatenating the child key to the object root key using the given separator.
This is an inverse of the flat->tree function. This is based on deep/tree->flat (see deep/tree->flat).
Supports any seqable objects (see seqable?). Other sequences are transformed to maps using plain/sequence->map.

Arguments:
- separator - A separator string used to form the flat map keys.
- tree      - A tree object is converted to a flat representation
- root-key  - Root key defines the root key for the tree object - use nil for empty
- branch?   - A branch? predicate can be used to mark objects as part of tree structure and not a value see deep/tree->flat.
The default implementation will branch only inside maps.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close