starNamesFromAttributesfunction
Settings from the two attributes a page offers, star-names (a count) and star-names-magnitude (a limit), read as text. Off when neither is there: names are never on unless asked. star-names with no value ("") asks for 10; a count of 0, a negative or text that is not a number asks for none.
Import it
import { starNamesFromAttributes } from "@johnmorrisdotca/hoshi-stars/sky-labels";
Definition
function starNamesFromAttributes(count: string | null | undefined, magnitude: string | null | undefined): StarNamesSettings | undefined
Parameters
| Name | Type | Description |
|---|---|---|
count | string | null | undefined | The value of |
magnitude | string | null | undefined | The value of |
Returns
StarNamesSettings | undefined
The settings, or undefined when names are off.
Examples
import { starNamesFromAttributes } from "@johnmorrisdotca/hoshi-stars/sky-labels";
console.log(starNamesFromAttributes("12", null), starNamesFromAttributes(null, "1.5"), starNamesFromAttributes(null, null));{ count: 12 } { magnitude: 1.5 } undefinedWhat it prints (run when this page was built)