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

Function compareVersions

packages/core/api/src/update-check.ts:95–103  ·  view source on GitHub ↗
(left: string, right: string)

Source from the content-addressed store, hash-verified

93 * either side is not parseable semver.
94 */
95export const compareVersions = (left: string, right: string): number | null => {
96 const lv = parseVersion(left);
97 const rv = parseVersion(right);
98 if (!lv || !rv) return null;
99 if (lv.major !== rv.major) return lv.major < rv.major ? -1 : 1;
100 if (lv.minor !== rv.minor) return lv.minor < rv.minor ? -1 : 1;
101 if (lv.patch !== rv.patch) return lv.patch < rv.patch ? -1 : 1;
102 return comparePrereleaseIdentifiers(lv.prerelease, rv.prerelease);
103};
104
105// ── dist-tags resolution ──────────────────────────────────────────────────
106

Callers 3

useLatestVersionFunction · 0.90
checkForUpdateFunction · 0.70

Calls 2

parseVersionFunction · 0.85

Tested by

no test coverage detected