Reference · Rolls and exact odds
readSetfunction
A set from a link's query, or null when it holds none or its dice cannot be rolled. A link with dice and no name is a set called by its notation.
Import it
import { readSet } from "@johnmorrisdotca/korokoro";
Definition
function readSet(query: string | URLSearchParams): DiceSet | null
Parameters
| Name | Type | Description |
|---|---|---|
query | string | URLSearchParams | A query string or URLSearchParams containing the shared settings. |
Returns
DiceSet | null
A set from a link's query, or null when it holds none or its dice cannot be rolled. A link with dice and no name is a set called by its notation.
Examples
import { readSet } from "@johnmorrisdotca/korokoro";
import { makeSet, setQuery } from "@johnmorrisdotca/korokoro";
const set = makeSet("Longsword", "1d8+3")!;
console.log(readSet(setQuery(set))?.name);LongswordWhat it prints (run when this page was built)