readResults関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Results typed or pasted from a real die, such as 3 5 6 6 1 or 3,5,6:
whole numbers separated by spaces, commas or new lines. sides is the die;
left out, it is taken to be the highest face seen, and at least 2. Says
which piece it could not read.
インポート
import { readResults } from "@johnmorrisdotca/korokoro";
定義
function readResults(text: string, sides?: number): TypedResults
引数
| 名前 | 型 | 説明 |
|---|---|---|
text | string | Text to parse, validate or format. |
sides (省略可) | number | undefined | A numbered die size or F for Fate dice. |
戻り値
TypedResults
Results typed or pasted from a real die, such as 3 5 6 6 1 or 3,5,6: whole numbers separated by spaces, commas or new lines. sides is the die; left out, it is taken to be the highest face seen, and at least 2. Says which piece it could not read.
例
import { readResults } from "@johnmorrisdotca/korokoro";
console.log(readResults("1 2 3 4 5 6", 6));{ ok: true, sides: 6, counts: [ 1, 1, 1, 1, 1, 1 ], rolls: 6 }出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。