commodities.Function.commoditiesInCategory - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki
@elite-dangerous-almanac/core / commodities / commoditiesInCategory
commoditiesInCategory(
category):Commodity[]
Defined in: src/commodities/commodities.ts:196
Every commodity in a given market group, in catalogue order.
string
The market group to match, e.g. "Metals". Leading/trailing
whitespace and case are ignored, like every other lookup here, so a group name
that arrived from a market payload or a user's dropdown resolves without
re-casing it first.
A new array of matches (possibly empty).
If category is present and not a string. A nullish
category is a miss, answered the way an unrecognised one is.
import { commoditiesInCategory } from '@elite-dangerous-almanac/core/commodities/commodities';
commoditiesInCategory('Metals').length; // -> every metal, standard and rare
commoditiesInCategory('metals').filter((c) => !c.rare).length; // -> the standard ones only