本文へ移動

Korokoroコロコロ

ダイスを組み合わせて振り、ダイス表記を読み取り、正確な確率を調べます。履歴の保存やシードを指定した再現もできます。

「コロコロ」は、小さなものが転がる様子を表す言葉です。 名前について(英語)

目次

リファレンス · ロールと正確な確率

CliSurroundings型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

What the command line is run in. All of it is optional.

インポート

import type { CliSurroundings } from "@johnmorrisdotca/korokoro";

定義

type CliSurroundings = {
    env?: Record<string, string | undefined>;
    stdin?: string;
    colour?: boolean;
    locale?: string;
    now?: number;
    source?: RandomSource;
};

メンバー

名前型説明
env (省略可)Record<string, string | undefined> | undefined

The environment, for the language (LC_ALL, LC_MESSAGES, LANG) and NO_COLOR.

stdin (省略可)string | undefined

Standard input, when --stdin asks for it: one notation to a line.

colour (省略可)boolean | undefined

Whether the output is a terminal that shows colour. NO_COLOR and --no-color still turn it off.

locale (省略可)string | undefined

The system's language where the environment names none: what Intl says, on Windows.

now (省略可)number | undefined

The time, in epoch milliseconds, for the rolls made. Now, unless given.

source (省略可)RandomSource | undefined

Where unseeded rolls come from. The crypto generator, unless given.

例

import type { CliSurroundings } from "@johnmorrisdotca/korokoro";
const value: CliSurroundings = { env: {}, locale: "en" };
console.log(value.locale);
en

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/korokoro 1.16.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。