commodities.Function.commoditiesInCategory - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / commodities / commoditiesInCategory

Function: commoditiesInCategory()

commoditiesInCategory(category): Commodity[]

Defined in: src/commodities/commodities.ts:196

Every commodity in a given market group, in catalogue order.

Parameters

category

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.

Returns

Commodity[]

A new array of matches (possibly empty).

Throws

If category is present and not a string. A nullish category is a miss, answered the way an unrecognised one is.

Example

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
⚠️ **GitHub.com Fallback** ⚠️