リファレンス · 星座の文化 (図形と文化の型、自分で作る文化)
defineCulture関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Makes a culture from a function that lists its figures. The figures are made on first use and shared after.
インポート
import { defineCulture } from "@johnmorrisdotca/hoshi-stars/culture";
定義
function defineCulture(id: string, names: Culture["names"], make: () => Asterism[]): Culture
引数
| 名前 | 型 | 説明 |
|---|---|---|
id | string | The culture's key. |
names | Readonly<{ en: string; ja: string; }> | Its name in English and Japanese. |
make | () => Asterism[] | Lists the figures. |
戻り値
Culture
The culture.
例
import { defineCulture } from "@johnmorrisdotca/hoshi-stars/culture";
const mine = defineCulture("mine", { en: "Mine", ja: "私の" }, () => [
{ id: "w", name: "W", names: { en: "The W" }, readings: {}, aka: [], about: "", kind: "asterism", group: undefined, missing: 0, chains: [[21, 168, 264, 403, 542]] },
]);
console.log(mine.find("the w")?.chains);[ [ 21, 168, 264, 403, 542 ] ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。