optionsFromAttributes関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The options read finds. A missing attribute is left out; nothing here is trusted as a real rocket.
インポート
import { optionsFromAttributes } from "@johnmorrisdotca/uchusen-rockets";
定義
function optionsFromAttributes(read: (name: string) => string | null): RocketOptions
引数
| 名前 | 型 | 説明 |
|---|---|---|
read | (name: string) => string | null | Reads one attribute by name and gives null when it is missing, as |
戻り値
RocketOptions
The choices found, as written. A missing attribute is left out of the result.
例
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' }出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。