MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / compareUpdateVersions

Function compareUpdateVersions

apps/desktop/src/main/updater-state.ts:38–49  ·  view source on GitHub ↗
(left: string, right: string)

Source from the content-addressed store, hash-verified

36};
37
38export const compareUpdateVersions = (left: string, right: string): number | null => {
39 const leftParts = parseVersionParts(left);
40 const rightParts = parseVersionParts(right);
41 if (!leftParts || !rightParts) return null;
42 const length = Math.max(leftParts.length, rightParts.length);
43 for (let index = 0; index < length; index += 1) {
44 const l = leftParts[index] ?? 0;
45 const r = rightParts[index] ?? 0;
46 if (l !== r) return l > r ? 1 : -1;
47 }
48 return 0;
49};
50
51const isNewerUpdateVersion = (incomingVersion: string, declinedVersion: string): boolean => {
52 const comparison = compareUpdateVersions(incomingVersion, declinedVersion);

Callers 2

isNewerUpdateVersionFunction · 0.85
planCompletedUpdateCheckFunction · 0.85

Calls 1

parseVersionPartsFunction · 0.70

Tested by

no test coverage detected