Skip to content

ships.Function.parseSlotName

github-actions[bot] edited this page Aug 26, 2026 · 74 revisions

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

Function: parseSlotName()

parseSlotName(slot): ParsedSlot | null

Defined in: src/ships/slots.ts:593

Classify a journal slot name — the Slot field of a SLEF/journal module — into a ParsedSlot.

Parameters

slot

string

The journal slot name, e.g. "FrameShiftDrive", "MediumHardpoint2", "Slot03_Size5", "Military01", "LargeMiningHardpoint1". Matched case-insensitively — see the remarks.

Returns

ParsedSlot | null

The classification, or null if the name is not a recognised slot. size is null for names that do not encode a size (a bare Military01).

Remarks

Every restricted mount has a journal name of its own, so the restriction is read off the name and needs no hull layout. The size still may: Cargo01 says only that the mount takes cargo, and getShipSlots carries how big it is.

Casing is not significant. Frontier writes FrameShiftDrive, but a SLEF producer may lower-case every slot key as the specification's own example does — Inara writes powerplant and largemininghardpoint1 — and both name the same mount. The returned core and restriction values keep this library's own camelCase spelling whatever the input looked like.

A _SizeN suffix is what the name says, not what the mount is. On three hulls the game's own key disagrees with the mount it names — the Keelback's Slot03_Size3 is a size-4 mount, the Asp Scout's Slot01_Size4 a size-5 one, and five of the Type-7 Transporter's ten are off. To size a mount, find it in the hull's layout (enumerateSlots) rather than trusting the number returned here.

Throws

If slot is present and not a string. A nullish slot is a miss, answered the way an unrecognised key is.

Example

import { parseSlotName } from '@elite-dangerous-almanac/core/ships/slots';

parseSlotName('Slot03_Size5'); // -> { kind: 'optional', size: 5 }
parseSlotName('HugeHardpoint1'); // -> { kind: 'hardpoint', size: 4 }
parseSlotName('LargeMiningHardpoint1');
// -> { kind: 'hardpoint', size: 3, restriction: 'mining' }
parseSlotName('Radar'); // -> { kind: 'core', size: null, core: 'sensors' }
parseSlotName('powerplant'); // -> { kind: 'core', size: null, core: 'powerPlant' }

API

Guides
astro
Classes (1)
ProceduralSystem

Properties

Accessors

Methods

Interfaces (16)
Type Aliases (3)
Variables (11)
Functions (37)
Subpath modules (3)
commodities
Interfaces (1)
Type Aliases (1)
Variables (3)
Functions (3)
equipment
Interfaces (6)
Type Aliases (8)
Variables (3)
Functions (10)
Subpath modules (2)
i18n
Interfaces (1)
Type Aliases (1)
Functions (17)
materials
Enumerations (2)
Interfaces (2)
Type Aliases (2)
Variables (9)
Functions (9)
ships
Classes (3)
BuildMetrics

Methods

LoadoutEditError

Constructors

Properties

Methods

ShipLoadout

Accessors

Methods

Interfaces (125)
Type Aliases (44)
Variables (10)
Functions (85)
Subpath modules (8)

Clone this wiki locally