Reference · Rolls and exact odds
withSetfunction
The sets with one added, newest first. A set of the same name is replaced, and the oldest go past MAX_SETS. Returns a new list.
Import it
import { withSet } from "@johnmorrisdotca/korokoro";
Definition
function withSet(sets: readonly DiceSet[], set: DiceSet): DiceSet[]
Parameters
| Name | Type | Description |
|---|---|---|
sets | readonly DiceSet[] | The saved sets to read or update. |
set | DiceSet | The saved set to add or share. |
Returns
DiceSet[]
The sets with one added, newest first. A set of the same name is replaced, and the oldest go past MAX_SETS. Returns a new list.
Examples
import { withSet } from "@johnmorrisdotca/korokoro";
import { makeSet } from "@johnmorrisdotca/korokoro";
const set = makeSet("Longsword", "1d8+3")!;
console.log(withSet([], set).map((saved) => saved.name));[ 'Longsword' ]What it prints (run when this page was built)