MCPcopy
hub / github.com/coder/mux / compareVersions

Function compareVersions

src/node/services/coderService.ts:73–83  ·  view source on GitHub ↗
(a: string, b: string)

Source from the content-addressed store, hash-verified

71 * - positive if a > b
72 */
73export function compareVersions(a: string, b: string): number {
74 const aParts = normalizeVersion(a).split(".").map(Number);
75 const bParts = normalizeVersion(b).split(".").map(Number);
76
77 for (let i = 0; i < Math.max(aParts.length, bParts.length); i++) {
78 const aPart = aParts[i] ?? 0;
79 const bPart = bParts[i] ?? 0;
80 if (aPart !== bPart) return aPart - bPart;
81 }
82 return 0;
83}
84
85const SIGKILL_GRACE_PERIOD_MS = 5000;
86

Callers 3

refreshPolicyOnceMethod · 0.90
getCoderInfoMethod · 0.85

Calls 1

normalizeVersionFunction · 0.85

Tested by

no test coverage detected