Skip to main content
Version: v0.0.4

Function: parseFixedWidth()

parseFixedWidth(source): object

Parse a FixedWidthSource into concepts and skipped-row warnings.

Parameters

source

FixedWidthSource

The fixed-width source.

Returns

object

The parsed concepts (by code) and the load warnings.

concepts

concepts: Map<string, Concept>

warnings

warnings: LoadWarning[]

Example

import { parseFixedWidth } from "@cosyte/terminology";

const { concepts } = parseFixedWidth({
format: "fixed-width",
content: "A00 1 Cholera",
fields: { code: { start: 0, end: 3 }, display: { start: 6 } },
});
concepts.get("A00")?.display; // => "Cholera"