INNER CODE UNIT · TypeScript

summaryMatch

cyanheads/pubmed-mcp-server · scripts/build-changelog.ts:93

  const summaryMatch = block.match(/^summary:\s*(.*)$/m);
  if (summaryMatch) {
    let raw = (summaryMatch[1] ?? '').trim();
    if ((raw.startsWith('"') && raw.endsWith('"')) || (raw.startsWith("'") && raw.endsWith("'"))) {
      raw = raw.slice(1, -1);
    }
    summary = raw.length > 0 ? raw : null;
  }
  if (summary !== null && summary.length > SUMMARY_MAX_LENGTH) {
    throw new Error(
      `${fileLabel}: summary is ${summary.length} chars, exceeds cap of ${SUMMARY_MAX_LENGTH}. Keep it tight — headline, not paragraph.`,
    );
  }

  const parseBool = (key: string): boolean => {
    const m = block.match(new RegExp(`^${key}:\\s*(\\S+)\\s*$`, 'm'));
    if (!m) return false;
    const val = m[1];

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…