materials.Function.getMaterialBySymbol - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki
@elite-dangerous-almanac/core / materials / getMaterialBySymbol
getMaterialBySymbol(
symbol,materials?):Material|null
Defined in: src/materials/materials.ts:221
Look up a material by its Frontier symbol / journal id (case-insensitive).
Here, symbol is Frontier's internal item id for the material.
string
The internal symbol, e.g. "GridResistors", or the lower-cased
form the player journal reports ("gridresistors"). Leading/trailing whitespace
and case are ignored.
readonly Material[] = ALL_MATERIALS
Optional subset to search instead of every material —
RAW_MATERIALS, MANUFACTURED_MATERIALS, ENCODED_MATERIALS, or any array you
have filtered yourself. Omit it unless you specifically want to exclude the rest:
the indexed O(1) path is taken only when the argument is omitted or is
ALL_MATERIALS by reference, and every other array — a copy of that same
catalogue included — is scanned.
Material | null
The matching Material, or null if no material has that symbol.
If symbol is present and not a string. A nullish
symbol is a miss, answered the way an unrecognised one is.
import { getMaterialBySymbol } from '@elite-dangerous-almanac/core/materials/materials';
getMaterialBySymbol('temperedalloys')?.name; // -> 'Tempered Alloys'