nameIndexfunction
An index over rows: by id, by exact name and by a ranked search. The rows are put in order, largest weight first and the id to break a tie.
Import it
import { nameIndex } from "@johnmorrisdotca/hoshi-stars/names";
Also exported from: @johnmorrisdotca/hoshi-stars/names/named, @johnmorrisdotca/hoshi-stars/names/ngc-ic
Definition
function nameIndex(input: readonly NameRow[]): NameIndex
Parameters
| Name | Type | Description |
|---|---|---|
input | readonly NameRow[] | The rows. Their ids must be unique. |
Returns
NameIndex
The lookups.
Examples
import { nameRows, nameIndex } from "@johnmorrisdotca/hoshi-stars/names";
console.log(nameIndex(nameRows().slice(0, 100)).find("Sirius")?.id);siriusWhat it prints (run when this page was built)