readSet関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
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 { readSet } from "@johnmorrisdotca/korokoro";
定義
function readSet(query: string | URLSearchParams): DiceSet | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
query | string | URLSearchParams | A query string or URLSearchParams containing the shared settings. |
戻り値
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.
例
import { readSet } from "@johnmorrisdotca/korokoro";
import { makeSet, setQuery } from "@johnmorrisdotca/korokoro";
const set = makeSet("Longsword", "1d8+3")!;
console.log(readSet(setQuery(set))?.name);Longsword出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。