リファレンス · 検索ボックス用の名前の一覧 (明るい星とメシエ天体ごとに、英語・日本語の名前、符号、星座、順位の重み、アドレスに使える ID、向ける先を持つ行。IDと名前で引けます)
NameIndex型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What an index of rows offers: the rows, one by id, one by any name, and a ranked search.
インポート
import type { NameIndex } from "@johnmorrisdotca/hoshi-stars/names";
ほかのエクスポート元: @johnmorrisdotca/hoshi-stars/names/named, @johnmorrisdotca/hoshi-stars/names/ngc-ic
定義
interface NameIndex {
rows(kinds?: readonly NameKind[]): NameRow[];
byId(id: string): NameRow | undefined;
find(text: string): NameRow | undefined;
search(text: string, options?: {
limit?: number;
kinds?: readonly NameKind[];
}): NameRow[];
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
rows | (kinds?: readonly NameKind[]): NameRow[] | The rows, brightest and best-known first, as a fresh array. |
byId | (id: string): NameRow | undefined | The row with that id, or |
find | (text: string): NameRow | undefined | The row a text names exactly (ignoring case, spacing, accents and the Greek letter's spelling), or |
search | (text: string, options?: { limit?: number; kinds?: readonly NameKind[]; }): NameRow[] | The rows whose names match: those that start with the text first, then those that contain it, each by weight; at most |
例
import { searchNames, type NameIndex } from "@johnmorrisdotca/hoshi-stars/names";
const found: ReturnType<NameIndex["search"]> = searchNames("andromeda", { limit: 3 });
console.log(found.map((row) => row.id));[ 'm31', 'alpheratz', 'mirach' ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。