Skip to content

@dice-roller/rpg-dice-roller / presenters

presenters ​

Presenters that format evaluated rolls and their results.

Classes ​

ClassDescription
TextPresenterPlain text output, matching v5: e.g. 4d6: [3, 5, 2, 6] = 16, with flag symbols after each die value and history rolls joined with "; ". It prints the supplied roll's total as-is: newly evaluated rolls round their total to 2 decimal places, but restored totals need not be rounded.
TreePresenterA presenter with a hook per result type.

Interfaces ​

InterfaceDescription
TextPresenterOptionsOptions for formatting flags and roll histories.

Variables ​

VariableDescription
DEFAULT_FLAG_SYMBOLSThe v5 flag symbols, e.g. [6!, 2, 1d].
defaultTextPresenterThe frozen shared instance used by roll, history, and roller toString() methods.

Functions ​

FunctionDescription
isExpressionResultNarrows a presentable to an expression result by the presence of type. This is a shallow shape check, not validation of the result or its type.
isRollNarrows a presentable to a roll by its shape: no type property and a result property. This is not validation of arbitrary input; lookalike objects can match.
isRollHistoryNarrows a presentable to a history by its shape: no type property and a rolls property. This is not validation of arbitrary input; lookalike objects can match.

References ​

Presentable ​

Re-exports Presentable


Presenter ​

Re-exports Presenter

MIT Licensed · Credits