本文へ移動

Toranpuトランプ

デッキを使い、11種類のゲームでコンピューターと対戦し、ソリティアを解いたり、独自の絵柄でカードを表示したりできます。

「トランプ」は、日本語で playing cards を指す言葉です。 名前について(英語)

目次

リファレンス · ゲームと状態

CliSurroundings型

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

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

インポート

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

定義

type CliSurroundings = {
    env?: Record<string, string | undefined>;
    stdin?: string;
    readFile?: (path: string) => string | null;
    colour?: boolean;
    locale?: string;
    seed?: () => number;
};

メンバー

名前型説明
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: a saved game.

readFile (省略可)((path: string) => string | null) | undefined

Reads a file named on the command line, or gives null when it cannot be read. check needs it; nothing else does.

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.

seed (省略可)(() => number) | undefined

Where a seed comes from when none is given: a function that returns a whole number from 1. randomSeed unless given.

例

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

const value: CliSurroundings = { env: {}, locale: "en", colour: false, seed: () => 42 };
console.log(value.locale);
en

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

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

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