Reference · Rockets, variants, parts and the fit check
scalePercentfunction
Clamps a size asked for to the slider's range and steps.
Import it
import { scalePercent } from "@johnmorrisdotca/uchusen-rockets";
Definition
function scalePercent(value: unknown): number
Parameters
| Name | Type | Description |
|---|---|---|
value | unknown | A number of per cent, or a string of one (an address's value). |
Returns
number
A whole number of per cent between 60 and 100, stepping by 5; 100 when the value is not a number.
Examples
import { scalePercent } from "@johnmorrisdotca/uchusen-rockets";
console.log(scalePercent("73"), scalePercent("nonsense"), scalePercent(10));75 100 60What it prints (run when this page was built)