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

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

Function: sumSourceModuleValues()

sumSourceModuleValues(record): number

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

Sum every per-slot price that the source stated.

Parameters

record

SourcePurchaseRecord

Purchase snapshot whose individually priced entries to add.

Returns

number

The stated total in credits, or 0 when no module was individually priced.

Remarks

This is deliberately not a replacement for SourcePurchaseRecord.modulesValue. A capture may omit individual prices or publish an inconsistent total; comparing the two is useful precisely because this function does not hide that discrepancy.

Example

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

declare const paid: SourcePurchaseRecord;
const partsAgree = paid.modulesValue === sumSourceModuleValues(paid);
⚠️ **GitHub.com Fallback** ⚠️