Functions

f
agoInWords(milliseconds: number): string

How long ago, in the shortest true words: just now, 12s ago, 4m ago, 2h ago.

f
durationTone(milliseconds: number): Tone

Which tone a round trip wears. A tenth of a second is where a person starts to notice waiting, and a second is where they start doing something else.

f
paintVerb(verb: string): string

The colour a verb wears, wherever a verb is printed — the reading ones cool, the writing ones warm, and the one that destroys something red. The same five every HTTP tool has taught.

f
printHeaders(
headers: ReadonlyMap<string, string>,
_palette: Theme
): string

A block of headers, one per line, with the names in the colour that means "this is what you came to find".

f
printRequest(
connection: HttpRequest,
palette: Theme
): string

Everything about one connection: what was sent, what came back, and the body.

f
printRequestLine(
connection: HttpRequest,
palette: Theme,
now: number
): string

One connection on one line, for a list of them: 2m ago #3 200 GET /api/users.

f
printStatus(
connection: HttpRequest,
palette: Theme
): string

The whole answer in one line: 200 OK · 101 bytes · 9ms | GET http://localhost:4000/api/users | #3.

f
printTarget(request: HttpRequest["request"]): string

What a request was for: GET http://localhost:4321/api/users.

f
sizeTone(bytes: number): Tone

Which tone a body size wears. A terminal stops being comfortable around a hundred kilobytes and stops coping around a megabyte, so those are the two boundaries.

f
statusTone(status: number): Tone

Which tone a status wears — the one place the four classes are decided.

Type Aliases

T
Tone = "good" | "warn" | "info" | "bad"

What a number or a status is worth saying about: the vocabulary every colour here is chosen from.

Variables

v
MAX_BODY_PREVIEW_LINES_COUNT: 40

How much of a body a request command prints before it starts saying "there is more".