Skip to content

@dice-roller/rpg-dice-roller / ast / nodeToNotation

Function: nodeToNotation() ​

nodeToNotation(node): string

Defined in: src/ast/notation.ts:29

Converts an expression to canonical notation, e.g. a pool to 4d6kh3.

Parentheses may be added to preserve precedence. Parsed notation round-trips through the parser, but arbitrary builder nodes need not: for example, range, face, and custom dice are written as display-only name(args) forms, and ambiguous != comparisons may be written as <>.

Parameters ​

node ​

ExpressionNode

Returns ​

string

MIT Licensed · Credits