formatProgressBar
Formats a value as a text progress bar, repeating filledChar/emptyChar across width
cells proportional to value / max.
value is clamped to [0, max] before computing the ratio — out-of-range values (negative,
above max) produce an empty or fully-filled bar instead of throwing. Non-finite max
(NaN, Infinity) is treated as 0, yielding an empty bar.
Available since v3.0.1
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | number | The current value |
options | ProgressBarOptions | Bar rendering options |
Returns
Section titled “Returns”string — A string of width repeated filled/empty characters
Examples
Section titled “Examples”Default 20-cell bar
Section titled “Default 20-cell bar”Renders a percentage as a filled/empty block bar using the default width and characters.
Custom width, characters, and scale
Section titled “Custom width, characters, and scale”Renders a value against a custom max, width, and fill characters — useful for anything scored out of a different total than 100.
Related Types
Section titled “Related Types”ProgressBarOptions
Section titled “ProgressBarOptions”Options for formatProgressBar.
