ships.Function.toSlef - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki
@elite-dangerous-almanac/core / ships / toSlef
toSlef(
data,header):Slef
Defined in: src/ships/slef.ts:614
Wrap one or more loadouts in SLEF envelopes.
LoadoutEvent | readonly LoadoutEvent[]
A single Loadout event or several. Several travel in one export as
separate entries, which is what the format's array top level is for.
Which exporting app to credit. SLEF attribution belongs to the application producing the export, so callers must provide its name and version.
The export, one entry per loadout, in the order given.
If data is empty, or the header or any loadout does not match
the record shape. Every entry is checked with the same guards parseSlef
applies, so anything this returns is guaranteed to parse back.
import type { ShipLoadout } from '@elite-dangerous-almanac/core/ships/ship-loadout';
import { stringifySlef, toSlef } from '@elite-dangerous-almanac/core/ships/slef';
declare const build: ShipLoadout;
const slef = toSlef(build.toLoadoutEvent(), { appName: 'MyApp', appVersion: '1.2.0' });
stringifySlef(slef); // -> '[{"header":{...},"data":{...}}]'