MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / parseVersion

Function parseVersion

packages/internal/src/utils/version-utils.ts:16–26  ·  view source on GitHub ↗
(version: string)

Source from the content-addressed store, hash-verified

14 * Parse a semantic version string into its components
15 */
16export function parseVersion(version: string): Version {
17 const match = version.match(/^(\d+)\.(\d+)\.(\d+)$/)
18 if (!match) {
19 throw new Error(`Invalid semantic version format: ${version}`)
20 }
21 return {
22 major: parseInt(match[1], 10),
23 minor: parseInt(match[2], 10),
24 patch: parseInt(match[3], 10),
25 }
26}
27
28export function stringifyVersion(version: Version): string {
29 return `${version.major}.${version.minor}.${version.patch}`

Callers 2

determineNextVersionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected