Fix nil values in commit and tag tables

This commit is contained in:
ViViDboarder 2022-04-18 17:05:26 -07:00
parent 0ccfe90fac
commit 617bbf780f
2 changed files with 8 additions and 2 deletions

View File

@ -208,7 +208,7 @@ use("folke/trouble.nvim")
use({ use({
"jose-elias-alvarez/null-ls.nvim", "jose-elias-alvarez/null-ls.nvim",
commit = utils.map_version_rule({ commit = utils.map_version_rule({
[">=0.6.0"] = nil, [">=0.6.0"] = utils.nil_val,
[">=0.5.1"] = "739a98c12bedaa2430c4a3c08d1d22ad6c16513e", [">=0.5.1"] = "739a98c12bedaa2430c4a3c08d1d22ad6c16513e",
[">=0.5.0"] = "3e7390735501d0507bf2c2b5c2e7a16f58deeb81", [">=0.5.0"] = "3e7390735501d0507bf2c2b5c2e7a16f58deeb81",
}), }),
@ -297,7 +297,7 @@ use({
"nvim-telescope/telescope-file-browser.nvim", "nvim-telescope/telescope-file-browser.nvim",
}, },
tag = utils.map_version_rule({ tag = utils.map_version_rule({
[">=0.6.0"] = nil, [">=0.6.0"] = utils.nil_val,
["<0.6.0"] = "nvim-0.5.1", ["<0.6.0"] = "nvim-0.5.1",
["==0.5.0"] = "nvim-0.5.0", ["==0.5.0"] = "nvim-0.5.0",
}), }),

View File

@ -153,6 +153,8 @@ function M.materialize_list(list, iterator)
return list return list
end end
M.nil_val = {}
-- Maps a set of version rules to a value eg. [">0.5.0"] = "has 0.5.0" -- Maps a set of version rules to a value eg. [">0.5.0"] = "has 0.5.0"
-- If more than one rule matches, the one with the greatest version number is used -- If more than one rule matches, the one with the greatest version number is used
function M.map_version_rule(rules) function M.map_version_rule(rules)
@ -197,6 +199,10 @@ function M.map_version_rule(rules)
end end
-- Return highest versioned matched value -- Return highest versioned matched value
if latest_value == M.nil_val then
return nil
end
return latest_value return latest_value
end end