MCPcopy
hub / github.com/foambubble/foam / isNewerVersion

Function isNewerVersion

packages/foam-cli/src/support/version.ts:20–27  ·  view source on GitHub ↗
(candidate: string, current: string)

Source from the content-addressed store, hash-verified

18}
19
20export function isNewerVersion(candidate: string, current: string): boolean {
21 const parse = (v: string) => v.split('.').map(Number);
22 const [cMaj, cMin, cPat] = parse(candidate);
23 const [rMaj, rMin, rPat] = parse(current);
24 if (cMaj !== rMaj) return cMaj > rMaj;
25 if (cMin !== rMin) return cMin > rMin;
26 return cPat > rPat;
27}
28
29export function fetchLatestVersion(options: { allowProcessExit?: boolean } = {}): Promise<string> {
30 return new Promise((resolve, reject) => {

Callers 3

runUpdateCommandFunction · 0.90
version.test.tsFile · 0.90
checkForUpdateNoticeFunction · 0.85

Calls 1

parseFunction · 0.70

Tested by

no test coverage detected