seniority
API reference

seniority/explain

Every export of seniority/explain, with its signature and doc comment: explain, explanation, renderExplanation, plus 1 type.

import { explain, explanation, renderExplanation } from 'seniority/explain';

Functions

explain

The rendered form: what --explain prints.

function explain(name: string, resolution: Resolution): string;
ParameterType
namestring
resolutionResolution

Returns string

explanation

The record. Everything else in this file renders it.

function explanation(key: string, resolution: ExplainedResolution): Explanation;
ParameterType
keystring
resolutionExplainedResolution

Returns Explanation

renderExplanation

The human rendering — what explain() returns and a terminal prints.

function renderExplanation(e: Explanation): string;
ParameterType
eExplanation

Returns string

Interfaces

Explanation

interface Explanation {
    /** The option asked about. */
    key: string;
    /** False when the command declares no such option — different from "declared and unset". */
    declared: boolean;
    /** The resolved value, or `undefined` when no source set one. */
    value: unknown;
    /** The candidate that won, or `undefined` when none did. */
    winner?: ExplainedCandidate;
    /** Every candidate, in `ORDER`. The truth table for this one option. */
    candidates: ExplainedCandidate[];
    /** Candidates that set a value and were outranked. */
    lost: ExplainedCandidate[];
    /**
     * Candidates that were consulted and had nothing. Kept apart from `lost` because
     * "the config file says `lib` and the flag beat it" and "there is no config file" are
     * different answers, and `--explain` exists to tell them apart.
     */
    unset: ExplainedCandidate[];
}

On this page