clampStrengthfunction
A strength held to 0 up to 1. A value that is not a number is the default.
Import it
import { clampStrength } from "@johnmorrisdotca/hoshi-stars/sky-labels";
Definition
function clampStrength(value: unknown, fallback?: number): number
Parameters
| Name | Type | Description |
|---|---|---|
value | unknown | Any number, or anything else. |
fallback (optional) | number | What to answer for a value that is not a number; |
Returns
number
A number from 0 to 1.
Examples
import { clampStrength } from "@johnmorrisdotca/hoshi-stars/sky-labels";
console.log(clampStrength(3), clampStrength(-1), clampStrength(0.35), clampStrength("soft"));1 0 0.35 0.16What it prints (run when this page was built)