astro.Function.getNebulaByName - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki
@elite-dangerous-almanac/core / astro / getNebulaByName
getNebulaByName(
name,nebulae):Nebula|null
Defined in: src/astro/nebulae.ts:274
Look up a nebula by name (case-insensitive).
string
The nebula name as the catalogue spells it, e.g.
"Witch Head Nebula". Matching ignores case and surrounding whitespace on both the
argument and the catalogue's own name, but is otherwise exact — including any
parenthetical community name ("Aemonz WZ-Y e6771 (Lazurite Nebula)"), so pass the
whole string. A record whose name is not a string never matches.
readonly Nebula[]
The catalogue to search (see nearestNebulae).
Nebula | null
The matching Nebula, or null if the catalogue holds no nebula
of that name. Only the catalogue you pass is searched — a real nebula will not
be found in PLANETARY_NEBULAE.
If name is present and not a string. A nullish
name is a miss, answered the way an unrecognised one is.
import { getNebulaByName } from '@elite-dangerous-almanac/core/astro/nebulae';
import { REAL_NEBULAE } from '@elite-dangerous-almanac/core/astro/nebulae-real';
getNebulaByName('witch head nebula', REAL_NEBULAE)?.system;
// -> 'Witch Head Sector RY-R b4-0'