Primitive value encoding for TOON format.
Handles encoding of nil, booleans, numbers, and strings.
Primitive value encoding for TOON format. Handles encoding of nil, booleans, numbers, and strings.
(encode value)(encode value delimiter)Encodes a primitive value to its TOON string representation.
Encoding rules:
Parameters:
Returns: String representation of the primitive value.
Examples: (encode nil) ;=> "null" (encode true) ;=> "true" (encode 42) ;=> "42" (encode "simple") ;=> "simple" (encode "has, comma") ;=> ""has, comma""
Encodes a primitive value to its TOON string representation. Encoding rules: - nil → "null" - true → "true" - false → "false" - numbers → string representation - strings → quoted if necessary based on delimiter Parameters: - value: Primitive value (nil, boolean, number, or string) - delimiter: Delimiter character being used (default: comma) Returns: String representation of the primitive value. Examples: (encode nil) ;=> "null" (encode true) ;=> "true" (encode 42) ;=> "42" (encode "simple") ;=> "simple" (encode "has, comma") ;=> "\"has, comma\""
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 |