MCPcopy Create free account
hub / github.com/garrytan/gstack / parseV

Function parseV

scripts/compare-pr-version.ts:50–53  ·  view source on GitHub ↗
(s: string)

Source from the content-addressed store, hash-verified

48
49// Parse versions for comparison.
50function parseV(s: string): number[] | null {
51 const m = s.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
52 return m ? [Number(m[1]), Number(m[2]), Number(m[3]), Number(m[4])] : null;
53}
54function cmp(a: number[], b: number[]): number {
55 for (let i = 0; i < 4; i++) if (a[i] !== b[i]) return a[i] - b[i];
56 return 0;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected