MCPcopy Create free account
hub / github.com/chhoumann/MetaEdit / extractFullLineField

Method extractFullLineField

src/parser.ts:417–432  ·  view source on GitHub ↗
(line: string)

Source from the content-addressed store, hash-verified

415 }
416
417 private extractFullLineField(line: string): InlineField | null {
418 const lineEnd = line.endsWith("\r") ? line.length - 1 : line.length;
419 const prefix = line.match(FULL_LINE_PREFIX)?.[0] ?? "";
420 const body = line.slice(prefix.length, lineEnd);
421
422 const sep = body.indexOf("::");
423 if (sep < 0) return null;
424
425 const key = body.substring(0, sep).trim();
426 if (!key) return null;
427
428 const value = body.substring(sep + 2).trim();
429 // A full-line field has no wrapper: its value runs to end of line.
430 const sepEnd = prefix.length + sep + 2;
431 return {key, value, start: prefix.length, end: lineEnd, sepEnd, valueEnd: lineEnd};
432 }
433
434 /**
435 * Rewrite the value of every inline field named `key` on a single line,

Callers 1

parseLineFieldsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected