Reference · Rolls and exact odds
ExportedRolltype
One roll as the JSON export writes it.
Import it
import type { ExportedRoll } from "@johnmorrisdotca/korokoro";
Definition
type ExportedRoll = {
id: string;
notation: string;
spec: Roll["spec"];
faces: number[];
kept: boolean[];
total: number;
successes?: true;
words?: string[];
at: number;
time: string;
seed: string | null;
held?: boolean[];
loaded?: true;
set?: Roll["set"];
dice: DieRoll[];
};
Members
| Name | Type | Description |
|---|---|---|
id | string | |
notation | string | The dice as notation, its label included. |
spec | RollSpec | The same dice as a spec: what |
faces | number[] | Every die thrown, in the order thrown. |
kept | boolean[] | Which faces count. |
total | number | |
successes (optional) | true | undefined | True when the total is a count of successes. Left out otherwise. |
words (optional) | string[] | undefined | What the faces say, on a roll of custom dice. Left out otherwise. |
at | number | Epoch milliseconds, and the same moment as ISO 8601 in UTC. |
time | string | |
seed | string | null | |
held (optional) | boolean[] | undefined | |
loaded (optional) | true | undefined | |
set (optional) | { id: string; index: number; of: number; } | undefined | |
dice | DieRoll[] | What became of each die. |
Examples
import type { ExportedRoll } from "@johnmorrisdotca/korokoro";
import { DEFAULT_SPEC, rollFrom, exportedRoll } from "@johnmorrisdotca/korokoro";
const value: ExportedRoll = exportedRoll(rollFrom(DEFAULT_SPEC, [2, 5], "saved", 0, null)!);
console.log(value.total);7What it prints (run when this page was built)