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;| Parameter | Type |
|---|---|
name | string |
resolution | Resolution |
Returns string
explanation
The record. Everything else in this file renders it.
function explanation(key: string, resolution: ExplainedResolution): Explanation;| Parameter | Type |
|---|---|
key | string |
resolution | ExplainedResolution |
Returns Explanation
renderExplanation
The human rendering — what explain() returns and a terminal prints.
function renderExplanation(e: Explanation): string;| Parameter | Type |
|---|---|
e | Explanation |
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[];
}seniority/precedence
Every export of seniority/precedence, with its signature and doc comment: screaming, envName, envBoolean, resolve, ORDER, RANK and 1 more, plus 9 types.
seniority/plugin
Every export of seniority/plugin, with its signature and doc comment: validate, register, reset, registered, sources, CONTRACT and 1 more, plus 5 types.