Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

727 B
Raw Blame
const RELEASE_VERSION_PATTERN = /^v?(\d+)\.(\d+)\.(\d+)/;

export const parseReleaseVersion = (version: string): readonly [number, number, number] | null => {
  const match = RELEASE_VERSION_PATTERN.exec(version.trim());
  if (!match) {
    return null;
  }
  return [Number(match[1]), Number(match[2]), Number(match[3])];
};

export const isNewerVersion = (current: string, latest: string): boolean => {
  const currentParts = parseReleaseVersion(current);
  const latestParts = parseReleaseVersion(latest);
  if (!currentParts || !latestParts) {
    return false;
  }
  for (let i = 0; i < 3; i += 1) {
    if (latestParts[i] !== currentParts[i]) {
      return latestParts[i] > currentParts[i];
    }
  }
  return false;
};