MCPcopy Create free account
hub / github.com/afar1/fieldtheory-cli / readLineMappingEntry

Function readLineMappingEntry

src/current.ts:131–148  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

129}
130
131function readLineMappingEntry(value: unknown): CurrentDocumentLineNumberEntry | null {
132 if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
133 const record = value as ManifestRecord;
134 const visibleLine = positiveIntegerField(record.visibleLine);
135 const sourceLine = positiveIntegerField(record.sourceLine);
136 if (visibleLine === null || sourceLine === null) return null;
137
138 const entry: CurrentDocumentLineNumberEntry = {
139 visibleLine,
140 sourceLine,
141 text: typeof record.text === 'string' ? record.text : '',
142 };
143 const rowInSourceLine = positiveIntegerField(record.rowInSourceLine);
144 const rowsInSourceLine = positiveIntegerField(record.rowsInSourceLine);
145 if (rowInSourceLine !== null) entry.rowInSourceLine = rowInSourceLine;
146 if (rowsInSourceLine !== null) entry.rowsInSourceLine = rowsInSourceLine;
147 return entry;
148}
149
150function readLineMapping(value: unknown): CurrentDocumentLineMapping | null {
151 if (!value || typeof value !== 'object' || Array.isArray(value)) return null;

Callers

nothing calls this directly

Calls 1

positiveIntegerFieldFunction · 0.85

Tested by

no test coverage detected