MCPcopy Create free account
hub / github.com/getsentry/XcodeBuildMCP / compareSemver

Function compareSemver

src/utils/axe-helpers.ts:177–188  ·  view source on GitHub ↗

* Compare two semver strings a and b. * Returns 1 if a > b, -1 if a < b, 0 if equal.

(a: string, b: string)

Source from the content-addressed store, hash-verified

175 * Returns 1 if a > b, -1 if a < b, 0 if equal.
176 */
177function compareSemver(a: string, b: string): number {
178 const pa = a.split('.').map((n) => parseInt(n, 10));
179 const pb = b.split('.').map((n) => parseInt(n, 10));
180 const len = Math.max(pa.length, pb.length);
181 for (let i = 0; i < len; i++) {
182 const da = Number.isFinite(pa[i]) ? pa[i] : 0;
183 const db = Number.isFinite(pb[i]) ? pb[i] : 0;
184 if (da > db) return 1;
185 if (da < db) return -1;
186 }
187 return 0;
188}
189
190/**
191 * Determine whether the bundled AXe meets a minimum version requirement.

Callers 1

isAxeAtLeastVersionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected