1- local UTIL = {}
1+ local UTIL = {}
22
33UTIL .NodeBaseUrl = " /v%s/"
44UTIL .FileName = " node-v%s-%s-%s%s"
@@ -12,8 +12,6 @@ function UTIL.getBaseUrl()
1212 return mirror
1313end
1414
15-
16-
1715function UTIL .compare_versions (v1o , v2o )
1816 local v1 = v1o .version
1917 local v2 = v2o .version
@@ -40,7 +38,6 @@ function UTIL.compare_versions(v1o, v2o)
4038 return false
4139end
4240
43-
4441function UTIL .get_checksum (file_content , file_name )
4542 for line in string.gmatch (file_content , ' ([^\n ]*)\n ?' ) do
4643 local checksum , name = string.match (line , ' (%w+)%s+(%S+)' )
@@ -57,25 +54,23 @@ function UTIL.is_semver_simple(str)
5754 return str :match (pattern ) ~= nil
5855end
5956
60-
6157function UTIL .extract_semver (semver )
6258 local pattern = " ^(%d+)%.(%d+)%.[%d.]+$"
6359 local major , minor = semver :match (pattern )
6460 return major , minor
6561end
6662
67-
6863function UTIL .calculate_shorthand (list )
6964 local versions_shorthand = {}
7065 for _ , v in ipairs (list ) do
7166 local version = v .version
72- local major , minor = extract_semver (version )
67+ local major , minor = UTIL . extract_semver (version )
7368
7469 if major then
7570 if not versions_shorthand [major ] then
7671 versions_shorthand [major ] = version
7772 else
78- if compare_versions ({version = version }, {version = versions_shorthand [major ]}) then
73+ if UTIL . compare_versions ({ version = version }, { version = versions_shorthand [major ] }) then
7974 versions_shorthand [major ] = version
8075 end
8176 end
@@ -85,7 +80,7 @@ function UTIL.calculate_shorthand(list)
8580 if not versions_shorthand [major_minor ] then
8681 versions_shorthand [major_minor ] = version
8782 else
88- if compare_versions ({version = version }, {version = versions_shorthand [major_minor ]}) then
83+ if UTIL . compare_versions ({ version = version }, { version = versions_shorthand [major_minor ] }) then
8984 versions_shorthand [major_minor ] = version
9085 end
9186 end
@@ -96,4 +91,4 @@ function UTIL.calculate_shorthand(list)
9691 return versions_shorthand
9792end
9893
99- return UTIL
94+ return UTIL
0 commit comments