Skip to the content

Hoshi Stars星

The stars you can see without a telescope, with names, colours and distances; the 88 constellations with their lines and boundaries; the Messier objects; and seven map projections to draw them on.

Hoshi is the Japanese word 星 for a star. About the name

Contents

Reference · The data door: hand the package your own stars or objects as a source with its own licence and credit, and see whose data is on the screen

loadRecordsfunction

Reads a record source once, when it is added: the list is frozen, a record with a non-finite number (a NaN or an infinity in any number finite names) is skipped and counted, and a list over MAX_RECORDS is refused whole (bigger data must be tiles). It never throws: a source that throws or rejects is a failed read, and a read the signal aborted is aborted.

Import it

import { loadRecords } from "@johnmorrisdotca/hoshi-stars/door";

Definition

function loadRecords<R>(source: RecordSource<R>, signal: AbortSignal, finite?: (record: R) => readonly number[]): Promise<RecordsRead<R>>

Parameters

NameTypeDescription
sourceRecordSource<R>

The record source.

signalAbortSignal

Aborts the read (the source is removed or switched off).

finite (optional)((record: R) => readonly number[]) | undefined

The numbers of one record that must be finite, if any: (star) => [star.ra, star.dec, star.mag].

Returns

Promise<RecordsRead<R>>

What was found: the status, the frozen records, how many were skipped and, for a failed read, why.

Examples

import { loadRecords } from "./data-door.ts";

const read = await loadRecords(source, controller.signal, (star) => [star.ra, star.dec]); // read.records is frozen; read.skipped counts the NaNs

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/hoshi-stars 0.47.0.