MCPcopy Create free account
hub / github.com/melonjs/melonJS / checkVersion

Function checkVersion

packages/melonjs/src/utils/utils.ts:31–44  ·  view source on GitHub ↗
(v1: string, v2: string)

Source from the content-addressed store, hash-verified

29 * }
30 */
31export function checkVersion(v1: string, v2: string) {
32 // Convert to proper "x.y.z" format if necessary
33 if (/^\d+$/.test(v1)) {
34 v1 += ".0.0";
35 } else if (/^\d+\.\d+$/.test(v1)) {
36 v1 += ".0";
37 }
38 if (/^\d+$/.test(v2)) {
39 v2 += ".0.0";
40 } else if (/^\d+\.\d+$/.test(v2)) {
41 v2 += ".0";
42 }
43 return compare(v1, v2);
44}
45
46/**
47 * parse the fragment (hash) from a URL and returns them into

Callers 2

registerFunction · 0.90
constructorMethod · 0.90

Calls 1

compareFunction · 0.90

Tested by

no test coverage detected