Skip to the content

Uchusen Rockets宇宙船

Rockets drawn from sourced sizes: line drawings and painted 3D views you drop into a page, take apart and turn round, and a typed model that checks whether a rocket really goes together.

Uchusen is the Japanese word 宇宙船 for spaceship. About the name

Contents

Reference · Rockets, variants, parts and the fit check

ShipListtype

A ship as the kit sees it: a list of modules, bottom of the spine first.

Import it

import type { ShipList } from "@johnmorrisdotca/uchusen-rockets";

Definition

type ShipList = readonly ShipPlace[];

Members

NameTypeDescription
lengthnumber

Gets the length of the array. This is a number one higher than the highest element defined in an array.

toString(): string

Returns a string representation of an array.

toLocaleString(): string (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string

Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.

concat(...items: ConcatArray<ShipPlace>[]): ShipPlace[] (...items: (ShipPlace | ConcatArray<ShipPlace>)[]): ShipPlace[]

Combines two or more arrays.

join(separator?: string): string

Adds all the elements of an array separated by the specified separator string.

slice(start?: number, end?: number): ShipPlace[]

Returns a section of an array.

indexOf(searchElement: ShipPlace, fromIndex?: number): number

Returns the index of the first occurrence of a value in an array.

lastIndexOf(searchElement: ShipPlace, fromIndex?: number): number

Returns the index of the last occurrence of a specified value in an array.

every<S extends ShipPlace>(predicate: (value: ShipPlace, index: number, array: readonly ShipPlace[]) => value is S, thisArg?: any): this is readonly S[] (predicate: (value: ShipPlace, index: number, array: readonly ShipPlace[]) => unknown, thisArg?: any): boolean

Determines whether all the members of an array satisfy the specified test.

some(predicate: (value: ShipPlace, index: number, array: readonly ShipPlace[]) => unknown, thisArg?: any): boolean

Determines whether the specified callback function returns true for any element of an array.

forEach(callbackfn: (value: ShipPlace, index: number, array: readonly ShipPlace[]) => void, thisArg?: any): void

Performs the specified action for each element in an array.

map<U>(callbackfn: (value: ShipPlace, index: number, array: readonly ShipPlace[]) => U, thisArg?: any): U[]

Calls a defined callback function on each element of an array, and returns an array that contains the results.

filter<S extends ShipPlace>(predicate: (value: ShipPlace, index: number, array: readonly ShipPlace[]) => value is S, thisArg?: any): S[] (predicate: (value: ShipPlace, index: number, array: readonly ShipPlace[]) => unknown, thisArg?: any): ShipPlace[]

Returns the elements of an array that meet the condition specified in a callback function.

reduce(callbackfn: (previousValue: ShipPlace, currentValue: ShipPlace, currentIndex: number, array: readonly ShipPlace[]) => ShipPlace): ShipPlace (callbackfn: (previousValue: ShipPlace, currentValue: ShipPlace, currentIndex: number, array: readonly ShipPlace[]) => ShipPlace, initialValue: ShipPlace): ShipPlace <U>(callbackfn: (previousValue: U, currentValue: ShipPlace, currentIndex: number, array: readonly ShipPlace[]) => U, initialValue: U): U

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

reduceRight(callbackfn: (previousValue: ShipPlace, currentValue: ShipPlace, currentIndex: number, array: readonly ShipPlace[]) => ShipPlace): ShipPlace (callbackfn: (previousValue: ShipPlace, currentValue: ShipPlace, currentIndex: number, array: readonly ShipPlace[]) => ShipPlace, initialValue: ShipPlace): ShipPlace <U>(callbackfn: (previousValue: U, currentValue: ShipPlace, currentIndex: number, array: readonly ShipPlace[]) => U, initialValue: U): U

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

find<S extends ShipPlace>(predicate: (value: ShipPlace, index: number, obj: readonly ShipPlace[]) => value is S, thisArg?: any): S | undefined (predicate: (value: ShipPlace, index: number, obj: readonly ShipPlace[]) => unknown, thisArg?: any): ShipPlace | undefined

Returns the value of the first element in the array where predicate is true, and undefined otherwise.

findIndex(predicate: (value: ShipPlace, index: number, obj: readonly ShipPlace[]) => unknown, thisArg?: any): number

Returns the index of the first element in the array where predicate is true, and -1 otherwise.

entries(): ArrayIterator<[number, ShipPlace]>

Returns an iterable of key, value pairs for every entry in the array

keys(): ArrayIterator<number>

Returns an iterable of keys in the array

values(): ArrayIterator<ShipPlace>

Returns an iterable of values in the array

includes(searchElement: ShipPlace, fromIndex?: number): boolean

Determines whether an array includes a certain element, returning true or false as appropriate.

flatMap<U, This = undefined>(callback: (this: This, value: ShipPlace, index: number, array: ShipPlace[]) => U | readonly U[], thisArg?: This | undefined): U[]

Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1.

flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[]

Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

at(index: number): ShipPlace | undefined

Returns the item located at the specified index.

findLast<S extends ShipPlace>(predicate: (value: ShipPlace, index: number, array: readonly ShipPlace[]) => value is S, thisArg?: any): S | undefined (predicate: (value: ShipPlace, index: number, array: readonly ShipPlace[]) => unknown, thisArg?: any): ShipPlace | undefined

Returns the value of the last element in the array where predicate is true, and undefined otherwise.

findLastIndex(predicate: (value: ShipPlace, index: number, array: readonly ShipPlace[]) => unknown, thisArg?: any): number

Returns the index of the last element in the array where predicate is true, and -1 otherwise.

toReversed(): ShipPlace[]

Copies the array and returns the copied array with all of its elements reversed.

toSorted(compareFn?: ((a: ShipPlace, b: ShipPlace) => number) | undefined): ShipPlace[]

Copies and sorts the array.

toSpliced(start: number, deleteCount: number, ...items: ShipPlace[]): ShipPlace[] (start: number, deleteCount?: number): ShipPlace[]

Copies an array and removes elements while, if necessary, inserting new elements in their place, returning the remaining elements. Copies an array and removes elements while returning the remaining elements.

with(index: number, value: ShipPlace): ShipPlace[]

Copies an array, then overwrites the value at the provided index with the given value. If the index is negative, then it replaces from the end of the array

Examples

import { assemble, type ShipList } from "@johnmorrisdotca/uchusen-rockets";

const ship: ShipList = [{ module: "engine-fusion-1" }, { module: "tank-cryo-12" }];
console.log(assemble(ship).length);
25.5

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/uchusen-rockets 0.14.0.