Function: decodeEscapes()
decodeEscapes(
leaf,d,onUnknown?):string
Decode the four recognized ASTM escape mnemonics in a single already-split
leaf (a component string), substituting the active delimiters read from the
header. Unrecognized &…& bodies are preserved verbatim and reported through
onUnknown (never dropped, never guessed).
This runs after splitting, so a decoded delimiter becomes ordinary literal text and can never introduce a new split boundary.
Parameters
leaf
string
One component string, escape-aware split already applied.
d
The delimiters resolved from the header.
onUnknown?
Called once per unrecognized escape body encountered.
Returns
string
The decoded string.
Example
import { decodeEscapes, CANONICAL_DELIMITERS } from "@cosyte/astm";
decodeEscapes("1&S&40", CANONICAL_DELIMITERS); // "1^40"