Reference · Streams, draws and seeds
CliSurroundingstype
What the command line is run in. All of it is optional.
Import it
import type { CliSurroundings } from "@johnmorrisdotca/tane";
Definition
type CliSurroundings = {
env?: Record<string, string | undefined>;
stdin?: string;
colour?: boolean;
locale?: string;
now?: number;
random?: () => number;
};
Members
| Name | Type | Description |
|---|---|---|
env (optional) | Record<string, string | undefined> | undefined | The environment, for the language ( |
stdin (optional) | string | undefined | Standard input, when |
colour (optional) | boolean | undefined | Whether the output is a terminal that shows colour. |
locale (optional) | string | undefined | The system's language where the environment names none: what |
now (optional) | number | undefined | The time, in epoch milliseconds, for |
random (optional) | (() => number) | undefined | Where a seed comes from when none is given: a function like |
Examples
import { mulberry32 } from "@johnmorrisdotca/tane";
import type { CliSurroundings } from "@johnmorrisdotca/tane";
const random = mulberry32(42);
const value: CliSurroundings = { env: {}, locale: "en", colour: false, now: 1791720000000, random: mulberry32(42) };
console.log(value.locale);enWhat it prints (run when this page was built)