Reference · Rockets, variants, parts and the fit check
spaceLengthfunction
The length still flying, in metres, rounded. Null when the picture is the whole variant. The table and the picture's name both use this.
Import it
import { spaceLength } from "@johnmorrisdotca/uchusen-rockets";
Definition
function spaceLength(rocket: string, slots: readonly string[], parts: Readonly<Record<string, { value: unknown; }>> | undefined): number | null
Parameters
| Name | Type | Description |
|---|---|---|
rocket | string | The rocket's id. |
slots | readonly string[] | The variant's slots, from the bottom. |
parts | Readonly<Record<string, { value: unknown; }>> | undefined | The sourced length of each slot, when a source gave one. |
Returns
number | null
The rounded length of the slots still flying, or null when nothing is spent.
Examples
import { spaceLength, variantOf } from "@johnmorrisdotca/uchusen-rockets";
const starship = variantOf("starship", "v3");
console.log(spaceLength("starship", starship?.slots ?? [], starship?.facts.parts));52What it prints (run when this page was built)