withObjectsfunction
Adds the deep-sky objects of outside sources to the page's own. Each source is checked by validateSource (a TypeError at once for an empty credit, no licence or a clashing id), read once, and every record is checked: a position that is not on
the sky, a number that is not finite, no id, an unknown kind or an id that is taken is left out and counted, never returned. A source that throws or holds more than 200,000 records is failed and adds nothing.
To switch a source off, leave it out of the next call.
Import it
import { withObjects } from "@johnmorrisdotca/hoshi-stars/door";
Definition
function withObjects(sources: readonly ObjectSource[], options?: { own?: readonly DeepSkyObject[]; signal?: AbortSignal; }): Promise<ObjectsRead>
Parameters
| Name | Type | Description |
|---|---|---|
sources | readonly ObjectSource[] | The object sources. |
options (optional) | { own?: readonly DeepSkyObject[]; signal?: AbortSignal; } |
|
Returns
Promise<ObjectsRead>
The objects, their credits, and what was left out.
Examples
import { messier } from "@johnmorrisdotca/hoshi-stars/deep-sky";
import { creditLine, withObjects, type ObjectSource } from "@johnmorrisdotca/hoshi-stars/door";
declare const myObjects: ObjectSource;
const read = await withObjects([myObjects], { own: messier() });
console.log(read.objects.length, read.skipped, creditLine(read.credits, "en"));