Function: loadGems()
loadGems(
source):GemMap
Load a CMS GEM file into an immutable GemMap, keyed by source code.
Liberal on load: a structurally unusable line (not three whitespace-delimited fields, or a malformed 5-digit flag) is skipped and surfaced as a GemLoadWarning, never a partially-parsed entry. An unusable source is not possible here (an all-malformed file loads to an empty map with warnings) - there is no fatal for GEM load. Ships no GEM content: the entries are the caller's public-domain file.
Parameters
source
The GemSource (raw content + direction + version).
Returns
The immutable GemMap.
Example
import { loadGems, applyGem } from "@cosyte/terminology";
// Synthetic rows in the CMS GEM format (source target flags): an exact map and a No-Map.
const gems = loadGems({
direction: "9-to-10",
version: "2018",
content: "0010 A000 00000\nV290 NoDx 11000\n",
});
applyGem(gems, "0010").mapped; // => true