refactor!: dont add unnecessary empty lines

This commit is contained in:
Oleksandr Smirnov 2025-02-26 20:26:33 +02:00
parent 02cc77e81c
commit 5b233d877c
No known key found for this signature in database
6 changed files with 14 additions and 5 deletions

View file

@ -30,4 +30,16 @@ function utils.readfile_joined(path)
return table.concat(vim.fn.readfile(path), "\n")
end
---@param t string[]
---@return string[]
function utils.remove_empty_lines(t)
local res = {}
for _, line in ipairs(t) do
if line ~= "" then
table.insert(res, line)
end
end
return res
end
return utils