Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Operators — Transform

Transform operators are value → value pure functions. They never touch the outside world — no files, no network, no clipboard.

Most operators are list-aware: they adapt to the input kind. If the input contains ITEM_SEP (\x1F), it’s treated as a list; otherwise as a scalar. The operator documentation below notes the behavior for each kind.

Scalar operators

These accept scalar input only. List input is rejected.

base64 — encode / decode

SyntaxDescription
base64:encodeEncode value to base64
base64:decodeDecode base64 to string

Decode failure → empty string (not an error).

mods: 'base64:encode'
mods: 'base64:decode'

split — split string to list

SyntaxDescription
splitSplit by newline (default)
split:<sep>Split by separator

Accepts scalar only; always produces a list. Supports escape mnemonics in the separator (\n, \t, \s).

mods: 'split'           # split by newline
mods: 'split:,\s'       # split by comma-space

List → scalar operators

join — collapse list to string

SyntaxDescription
joinJoin with newline (default)
join:<sep>Join with custom separator

Supports escape mnemonics.

mods: 'join'             # newline-separated
mods: 'join:,\s'         # comma-space separated

item — Nth list element

SyntaxDescription
item:<N>Return element at index N (0-based)

Negative N counts from the end (item:-1 = last). Out of range → empty string. On scalar input: returns the whole string if N is 0, else empty.

mods: 'item:0'           # first element
mods: 'item:-1'          # last element

size — count / length

SyntaxDescription
sizeList → item count; scalar → byte length

Always returns a numeric string.

mods: 'size'

List filter operators

filter — keep / remove items by pattern

SyntaxDescription
filter:<X>Remove items containing X (substring)
filter:eq:<X>Remove items exactly equal to X
filter:not:<X>Keep items containing X (inverted)
mods: 'split|filter:eq:-'         # remove items equal to "-"
mods: 'split|filter:not:error'    # keep items containing "error"

grep — regex filter

SyntaxDescription
grep:<re>Keep items matching regex
grep:<re>:notRemove items matching regex

On scalar input: returns the whole string on match, else empty string.

mods: 'split|grep:^(feat|fix)'       # keep conventional commit lines
mods: 'split|grep:^\\s*$:not'        # remove blank lines

List sort / deduplicate operators

sort — alphabetical sort

SyntaxDescription
sortSort ascending (default)
sort:ascSort ascending
sort:descSort descending

On scalar: sorts characters.

mods: 'split|sort'
mods: 'split|sort:desc'

uniq — deduplicate

SyntaxDescription
uniqRemove duplicate items / characters

Preserves first occurrence order.

mods: 'split|uniq'

reverse — reverse order

SyntaxDescription
reverseList → reverse item order; scalar → reverse chars
mods: 'split|reverse'

List slice operators

take — first N elements

SyntaxDescription
take:<N>List → first N items; scalar → first N chars
mods: 'split|take:5'

tail — last N elements

SyntaxDescription
tail:<N>List → last N items; scalar → last N chars
mods: 'split|tail:3'

Per-item operators

These apply independently to each list item (or the whole scalar).

lower / upper — case conversion

SyntaxDescription
lowerTo lowercase
upperTo UPPERCASE
mods: 'split|lower'
mods: 'upper'

replace — substring replacement

SyntaxDescription
replace:<from>:<to>Replace all occurrences
mods: 'replace:old:new'

trim — trim whitespace / chars

SyntaxDescription
trimStrip whitespace from ends; remove empty list items
trim:<chars>Strip whitespace + chars; remove items equal to chars
mods: 'trim'            # strip whitespace, drop blanks
mods: 'trim:#'          # strip whitespace and '#', drop items equal to '#'

strip — remove Markdown fences

SyntaxDescription
stripRemove ```lang\\n...\\n```, ~~~, `, """ wrappers

Auto-detects the wrapper type. Returns the inner content, trimmed.

mods: 'strip'

default — fallback for empty

SyntaxDescription
default:<X>If value is empty → X, else passthrough

Per-item: each empty list item is replaced with X.

mods: 'default:N/A'

Format conversion

format — convert between data formats

SyntaxDescription
format:jsonConvert to JSON
format:json5Convert to JSON5
format:yamlConvert to YAML
format:tomlConvert to TOML

Auto-detects input format (tries JSON, JSON5, YAML, TOML in order). List-aware: each item is parsed independently, then wrapped into an array for JSON/JSON5 output, concatenated for YAML. TOML does not support top-level arrays.

mods: 'format:json'
mods: 'scan|ast|format:json'

Escape mnemonics

Operator arguments support \n, \t, \s escapes (e.g. join:,\s). Full escape system — see Placeholders & Escapes.