MCPcopy
hub / github.com/learnhouse/learnhouse / compareVersions

Function compareVersions

apps/cli/src/services/version-check.ts:7–15  ·  view source on GitHub ↗
(a: string, b: string)

Source from the content-addressed store, hash-verified

5const GHCR_BASE = 'ghcr.io/learnhouse/app'
6
7function compareVersions(a: string, b: string): number {
8 const pa = a.split('.').map(Number)
9 const pb = b.split('.').map(Number)
10 for (let i = 0; i < 3; i++) {
11 if ((pa[i] || 0) > (pb[i] || 0)) return 1
12 if ((pa[i] || 0) < (pb[i] || 0)) return -1
13 }
14 return 0
15}
16
17/**
18 * Check npm for the latest version and warn if outdated.

Callers 1

checkForUpdatesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected