Files
gpx.studio/website/src/lib/trackpoint-categories.ts
T
2026-10-04 19:14:41 +02:00

13 lines
410 B
TypeScript

/**
* The value of a trackpoint for a category of the engine (surface, highway): `codes` has one entry
* per trackpoint, 0 when the value is unknown, else 1 + the index of the value in `names`.
*/
export function categoryAt(
codes: ArrayLike<number>,
names: readonly string[],
index: number
): string | undefined {
const code = codes[index];
return code ? names[code - 1] : undefined;
}