MAJOR: Project rename and preparation for v1.0.0

I hope I haven't missed any for the renames!
This commit is contained in:
hedy
2023-11-12 12:40:32 +08:00
parent 2746f6f423
commit 965a3842c8
23 changed files with 141 additions and 118 deletions

View File

@@ -0,0 +1,49 @@
local M = {}
function M.table_to_str(t)
local ret = ''
for _, value in ipairs(t) do
ret = ret .. tostring(value)
end
return ret
end
function M.str_to_table(str)
local t = {}
for i = 1, #str do
t[i] = str:sub(i, i)
end
return t
end
--- Copies an array and returns it because lua usually does references
---@generic T
---@param t T[]
---@return T[]
function M.array_copy(t)
local ret = {}
for _, value in ipairs(t) do
table.insert(ret, value)
end
return ret
end
--- Deep copy a table, deeply excluding certain keys
function M.deepcopy_excluding(t, keys)
local res = {}
for key, value in pairs(t) do
if not vim.tbl_contains(keys, key) then
if type(value) == "table" then
res[key] = M.deepcopy_excluding(value, keys)
else
res[key] = value
end
end
end
return res
end
return M