Liking cljdoc? Tell your friends :D

com.vadelabs.toon.encode.encoders

Object (map) encoding for TOON format.

Handles encoding of maps with:

  • Simple key-value pairs
  • Nested objects with indentation
  • Arrays as values
  • Key collapsing for nested single-key objects
Object (map) encoding for TOON format.

Handles encoding of maps with:
- Simple key-value pairs
- Nested objects with indentation
- Arrays as values
- Key collapsing for nested single-key objects
raw docstring

key-value-pairclj/s

(key-value-pair k v options depth writer)
(key-value-pair k v options depth writer siblings)

Encodes a single key-value pair by dispatching to appropriate encoder.

Supports key collapsing for nested single-key objects when enabled.

Dispatches based on value type:

  • Primitives → primitive-pair
  • Empty arrays → empty-array-pair
  • Primitive arrays → primitive-array-pair
  • Complex arrays → complex-array-pair
  • Objects → object-pair (or collapsed key path)

Parameters:

  • k: String key
  • v: Any value (primitive, array, or object)
  • options: Encoding options map
  • depth: Current indentation depth
  • writer: LineWriter instance
  • siblings: Optional vector of sibling keys (for collapsing collision detection)

Returns: Updated LineWriter

Encodes a single key-value pair by dispatching to appropriate encoder.

Supports key collapsing for nested single-key objects when enabled.

Dispatches based on value type:
- Primitives → primitive-pair
- Empty arrays → empty-array-pair
- Primitive arrays → primitive-array-pair
- Complex arrays → complex-array-pair
- Objects → object-pair (or collapsed key path)

Parameters:
  - k: String key
  - v: Any value (primitive, array, or object)
  - options: Encoding options map
  - depth: Current indentation depth
  - writer: LineWriter instance
  - siblings: Optional vector of sibling keys (for collapsing collision detection)

Returns:
  Updated LineWriter
sourceraw docstring

objectclj/s

(object obj options depth writer)

Encodes a map to TOON format.

Collects all keys first to enable collapsing collision detection.

Parameters:

  • obj: Map to encode
  • options: Encoding options map with :delimiter and :key-collapsing
  • depth: Current indentation depth
  • writer: LineWriter instance

Returns: Updated LineWriter.

Encodes a map to TOON format.

Collects all keys first to enable collapsing collision detection.

Parameters:
  - obj: Map to encode
  - options: Encoding options map with :delimiter and :key-collapsing
  - depth: Current indentation depth
  - writer: LineWriter instance

Returns:
  Updated LineWriter.
sourceraw docstring

valueclj/s

(value v {:keys [delimiter] :as options} depth writer)

Encodes any value to TOON format.

Dispatch function that routes to appropriate encoder:

  • Primitives → primitive encoder
  • Arrays → array encoder
  • Objects → object encoder

Parameters:

  • v: Any value to encode
  • options: Encoding options map
  • depth: Current indentation depth
  • writer: LineWriter instance

Returns: Updated LineWriter.

Encodes any value to TOON format.

Dispatch function that routes to appropriate encoder:
- Primitives → primitive encoder
- Arrays → array encoder
- Objects → object encoder

Parameters:
  - v: Any value to encode
  - options: Encoding options map
  - depth: Current indentation depth
  - writer: LineWriter instance

Returns:
  Updated LineWriter.
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