Reference · Sky cultures: the figure and culture types, and your own culture
defineCulturefunction
Makes a culture from a function that lists its figures. The figures are made on first use and shared after.
Import it
import { defineCulture } from "@johnmorrisdotca/hoshi-stars/culture";
Definition
function defineCulture(id: string, names: Culture["names"], make: () => Asterism[]): Culture
Parameters
| Name | Type | Description |
|---|---|---|
id | string | The culture's key. |
names | Readonly<{ en: string; ja: string; }> | Its name in English and Japanese. |
make | () => Asterism[] | Lists the figures. |
Returns
Culture
The culture.
Examples
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 ] ]What it prints (run when this page was built)