Reference · Rolls and exact odds
readSharedfunction
A shared roll from a query string, or null when it does not describe one this roller could have thrown.
Import it
import { readShared } from "@johnmorrisdotca/korokoro";
Definition
function readShared(query: string | URLSearchParams): Roll | null
Parameters
| Name | Type | Description |
|---|---|---|
query | string | URLSearchParams | A query string or URLSearchParams containing the shared settings. |
Returns
Roll | null
A shared roll from a query string, or null when it does not describe one this roller could have thrown.
Examples
import { readShared } from "@johnmorrisdotca/korokoro";
import { normalizeSpec, rollFrom, shareQuery } from "@johnmorrisdotca/korokoro";
const spec = normalizeSpec({ count: 2, sides: 6 });
const sample = rollFrom(spec, [2, 5], "saved", 0, null)!;
console.log(readShared(shareQuery(sample))?.total);7What it prints (run when this page was built)