Skip to the content

Toranpuトランプ

Use a deck, play eleven games with computers, solve a solitaire, or display cards in your own design.

Toranpu is Japanese for playing cards. About the name

Contents

Reference · Games and state

CliSurroundingstype

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

Import it

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

Definition

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

Members

NameTypeDescription
env (optional)Record<string, string | undefined> | undefined

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

stdin (optional)string | undefined

Standard input, when --stdin asks for it: a saved game.

readFile (optional)((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 (optional)boolean | undefined

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

locale (optional)string | undefined

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

seed (optional)(() => number) | undefined

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

Examples

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

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

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/toranpu 2.15.0.