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

Function normalizeVersion

src/node/services/coderService.ts:60–65  ·  view source on GitHub ↗

* Normalize a version string for comparison. * Strips leading "v", dev suffixes like "-devel+hash", and build metadata. * Example: "v2.28.6+df47153" → "2.28.6"

(v: string)

Source from the content-addressed store, hash-verified

58 * Example: "v2.28.6+df47153""2.28.6"
59 */
60function normalizeVersion(v: string): string {
61 return v
62 .replace(/^v/i, "") // Strip leading v/V
63 .split("-")[0] // Remove pre-release suffix
64 .split("+")[0]; // Remove build metadata
65}
66
67/**
68 * Compare two semver versions. Returns:

Callers 1

compareVersionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected