Skip to content

DiceApi

Defined in: src/dice.ts:77

dice() totals; dice.detail() reports what each die showed.

dice("3d6"); // 11
dice("d20"); // 17
dice("2d10+3"); // 14
dice("1d4-1"); // 2
dice.detail("4d6+2"); // { total: 17, dice: [ 3, 6, 2, 4 ], modifier: 2 }

DiceApi(notation): number

Defined in: src/dice.ts:78

dice() totals; dice.detail() reports what each die showed.

string

number

dice("3d6"); // 11
dice("d20"); // 17
dice("2d10+3"); // 14
dice("1d4-1"); // 2
dice.detail("4d6+2"); // { total: 17, dice: [ 3, 6, 2, 4 ], modifier: 2 }

detail: (notation) => Roll

Defined in: src/dice.ts:79

Roll notation and return every die alongside the total.

string

Roll