Skip to the content

Korokoroコロコロ

Roll mixed dice or type notation, compare exact probabilities, keep a history and replay seeded rolls.

Korokoro describes something small rolling in Japanese. About the name

Contents

Reference · Rolls and exact odds

parseNotationfunction

A spec from notation, or null when the text is not dice this roller can throw. checkNotation says why.

Import it

import { parseNotation } from "@johnmorrisdotca/korokoro";

Definition

function parseNotation(text: string, options?: NotationOptions): RollSpec | null

Parameters

NameTypeDescription
textstring

Text to parse, validate or format.

options (optional)NotationOptions

Options for this call; omitted fields keep their documented defaults.

Returns

RollSpec | null

A spec from notation, or null when the text is not dice this roller can throw. checkNotation says why.

Examples

import { parseNotation } from "@johnmorrisdotca/korokoro";
console.log(parseNotation("2d20kh1+5"));
{ count: 2, sides: 20, modifier: 5, keep: 'highest' }

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/korokoro 1.16.0.