ships.Function.getShipGunsight - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / ships / getShipGunsight

Function: getShipGunsight()

getShipGunsight(shipSymbol): ShipGunsight | null

Defined in: src/ships/gunsights.ts:93

Look up a hull's gunsight by its internal symbol, case-insensitively.

Parameters

shipSymbol

string

Hull symbol, e.g. "SideWinder". Leading/trailing whitespace and case are ignored.

Returns

ShipGunsight | null

The deeply frozen gunsight, or null when the hull is unknown.

Throws

If shipSymbol is present and not a string. A nullish value is a miss, like any other unrecognised symbol.

Example

import { getShipGunsight } from '@elite-dangerous-almanac/core/ships/gunsights';

getShipGunsight(' sidewinder ')?.length; // -> 2
getShipGunsight('not_a_ship'); // -> null
⚠️ **GitHub.com Fallback** ⚠️