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

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

Function: getSourceModuleValue()

getSourceModuleValue(record, slotKey): SourceModuleValue | null

Defined in: src/ships/source-purchase.ts:140

Find the captured purchase entry for one slot.

Parameters

record

SourcePurchaseRecord

Purchase snapshot to query.

slotKey

string

Slot key such as "PowerPlant". An exact spelling wins; otherwise matching folds case and ignores surrounding whitespace, as every identifier lookup in the library does, so journal and lower-cased SLEF keys interoperate.

Returns

SourceModuleValue | null

The frozen entry, or null when the source priced no module in that slot. null never means the module was free.

Throws

If slotKey is present and not a string. A nullish slotKey is a miss, answered the way a slot the source did not price is.

Example

import {
    getSourceModuleValue,
    type SourcePurchaseRecord,
} from '@elite-dangerous-almanac/core/ships/source-purchase';

declare const paid: SourcePurchaseRecord;
getSourceModuleValue(paid, 'FrameShiftDrive')?.value; // captured credits
⚠️ **GitHub.com Fallback** ⚠️