Reference · Rockets, variants, parts and the fit check
optionsFromAttributesfunction
The options read finds. A missing attribute is left out; nothing here is trusted as a real rocket.
Import it
import { optionsFromAttributes } from "@johnmorrisdotca/uchusen-rockets";
Definition
function optionsFromAttributes(read: (name: string) => string | null): RocketOptions
Parameters
| Name | Type | Description |
|---|---|---|
read | (name: string) => string | null | Reads one attribute by name and gives null when it is missing, as |
Returns
RocketOptions
The choices found, as written. A missing attribute is left out of the result.
Examples
import { optionsFromAttributes } from "@johnmorrisdotca/uchusen-rockets";
const attributes: Record<string, string> = { rocket: "starship", look: "thick" };
console.log(optionsFromAttributes((name) => attributes[name] ?? null));{ rocket: 'starship', look: 'thick' }What it prints (run when this page was built)