findInCatalogue関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Find catalogue entries by name, group name, NORAD number, Japanese name or a group's Japanese label: "hubble", "hst", "25544", "weather" or "ハッブル".
An English or numeric query ignores case, spaces and punctuation, as before. Japanese is folded on both sides: letter case, character width (NFKC) and kana (foldKana: hiragana to katakana, small kana to full-size, the long-vowel mark left alone), so はっぶる finds ハッブル; kanji are matched as typed. The width fold is applied before the English comparison too.
A name that starts with the text comes before one that only has it inside.
インポート
import { findInCatalogue } from "@johnmorrisdotca/chikyu-earth/satellites";
定義
function findInCatalogue(text: string, limit?: number): CatalogueEntry[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
text | string | What the reader typed. |
limit (省略可) | number | The most entries to give back (8 by default). |
戻り値
CatalogueEntry[]
The matching entries, best first; none for empty text.
例
import { findInCatalogue } from "@johnmorrisdotca/chikyu-earth/satellites";
console.log(findInCatalogue("sentinel 2").map((entry) => entry.name));
console.log(findInCatalogue("ハッブル").map((entry) => entry.name));[ 'SENTINEL-2A', 'SENTINEL-2B' ]
[ 'HST' ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。