percentageToTier
Maps a numeric percentage to a tier (icon, color, label) using configurable thresholds.
Tiers are matched by their highest min that is <= value; a value below every tier’s
min (e.g. a negative percentage, or custom tiers that don’t cover down to 0) falls back to
the tier with the lowest min — there’s always a match as long as tiers is non-empty.
Available since v3.0.1
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | number | The percentage to classify (typically 0-100, but not clamped) |
tiers | readonly PercentageTier[] | Threshold tiers to match against, in any order (defaults to DEFAULT_PERCENTAGE_TIERS) |
Returns
Section titled “Returns”PercentageTier — The matched tier
Examples
Section titled “Examples”Coverage report tier
Section titled “Coverage report tier”Maps a coverage percentage to a tier using the built-in default thresholds.
Custom pass/fail tiers
Section titled “Custom pass/fail tiers”Supply your own tiers, e.g. a simple two-tier pass/fail gate.
Related Types
Section titled “Related Types”PercentageTier
Section titled “PercentageTier”A percentage threshold and the icon/color/label to use once a value reaches it.
