本文へ移動

Hoshi Stars星

肉眼で見える星の名前・色・距離、88星座の線と境界、メシエ天体、そしてそれらを描くための7種類の図法を使えます。

「星」(ほし) は、夜空に光って見えるものです。 名前について(英語)

目次

リファレンス · 検索ボックス用の名前の一覧 (明るい星とメシエ天体ごとに、英語・日本語の名前、符号、星座、順位の重み、アドレスに使える 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 undefined.

find(text: string): NameRow | undefined

The row a text names exactly (ignoring case, spacing, accents and the Greek letter's spelling), or undefined if none or more than one does.

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 limit (20 by default).

例

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' ]

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/hoshi-stars 0.47.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。