INNER CODE UNIT · TypeScript

parseBool

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

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

  return {
    summary,
    breaking: parseBool('breaking'),
    security: parseBool('security'),
  };
}

/** Extract the release date from the H1 heading. */

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…