mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
lua: move test helper function, map and filter, to vim.shared module
This commit is contained in:
@@ -290,24 +290,6 @@ module.tmpname = (function()
|
||||
end)
|
||||
end)()
|
||||
|
||||
function module.map(func, tab)
|
||||
local rettab = {}
|
||||
for k, v in pairs(tab) do
|
||||
rettab[k] = func(v)
|
||||
end
|
||||
return rettab
|
||||
end
|
||||
|
||||
function module.filter(filter_func, tab)
|
||||
local rettab = {}
|
||||
for _, entry in pairs(tab) do
|
||||
if filter_func(entry) then
|
||||
table.insert(rettab, entry)
|
||||
end
|
||||
end
|
||||
return rettab
|
||||
end
|
||||
|
||||
function module.hasenv(name)
|
||||
local env = os.getenv(name)
|
||||
if env and env ~= '' then
|
||||
|
||||
Reference in New Issue
Block a user