limitFromTextfunction
The limit from the attribute distance-limit (and the address's dist), read as text: a number of light-years, or all. Off (undefined) when the attribute is missing, off, or not a number: nothing is limited and the sky is as it was, drawn with no layers.
Import it
import { limitFromText } from "@johnmorrisdotca/hoshi-stars/distance";
Definition
function limitFromText(value: string | null | undefined): number | undefined
Parameters
| Name | Type | Description |
|---|---|---|
value | string | null | undefined | The text, or |
Returns
number | undefined
The limit in light-years (Infinity for all), or undefined for no layers.
Examples
import { limitFromText } from "@johnmorrisdotca/hoshi-stars/distance";
console.log(limitFromText("100"), limitFromText("all"), limitFromText(null), limitFromText("far"), limitFromText("-5"));100 Infinity undefined undefined undefinedWhat it prints (run when this page was built)