materials - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / materials

materials

Elite Dangerous materials — the ship-side engineering materials (raw, manufactured and encoded, each with a grade and in-game line) and the on-foot Odyssey micro resources (component, consumable, data and item, each a plain symbol/name registry record).

Every lookup searches the whole registry by default — import the function and call it:

import {
  getMaterialByName,
  materialsByGrade,
  materialsInCategory,
  getMicroResourceBySymbol,
  MaterialGrade,
} from '@elite-dangerous-almanac/core/materials';

getMaterialByName('iron')?.grade;               // -> MaterialGrade.VeryCommon
materialsByGrade(MaterialGrade.Rare)[0]?.name; // -> 'Yttrium'
materialsInCategory('raw')[0]?.name;           // -> 'Carbon'
getMicroResourceBySymbol('graphene')?.name;     // -> 'Graphene'

The by-key lookups also take an optional trailing argument to narrow the search to a subset — one category's catalogue, or an array you have filtered yourself. It must be one of the exported catalogues by reference; ALL_MATERIALS (or omitting it) is the one that answers from an index rather than a scan:

import { getMaterialByName } from '@elite-dangerous-almanac/core/materials';
import { RAW_MATERIALS } from '@elite-dangerous-almanac/core/materials/materials-raw';

getMaterialByName('imperial shielding', RAW_MATERIALS); // -> null; it is manufactured

A lookup that returns an array takes no catalogue — narrow its result, or the subset you already imported, with .filter():

import { MaterialGrade } from '@elite-dangerous-almanac/core/materials';
import { RAW_MATERIALS } from '@elite-dangerous-almanac/core/materials/materials-raw';

RAW_MATERIALS.filter((m) => m.grade === MaterialGrade.Rare).map((m) => m.name);
// -> ['Yttrium', 'Selenium', 'Antimony', 'Tellurium', 'Technetium', 'Polonium', 'Ruthenium']

Enumerations

Interfaces

Type Aliases

Variables

Functions

⚠️ **GitHub.com Fallback** ⚠️