feat: add dict_merge() function (#1609)

This commit is contained in:
三咲雅 · Misaki Masa 2024-09-04 21:45:51 +08:00 committed by GitHub
parent 322f5fc230
commit e3c653154f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,7 +21,12 @@ function ya.list_merge(a, b)
return a
end
function ya.basename(s) return s:gsub("(.*[/\\])(.*)", "%2") end
function ya.dict_merge(a, b)
for k, v in pairs(b) do
a[k] = v
end
return a
end
function ya.readable_size(size)
local units = { "B", "K", "M", "G", "T", "P", "E", "Z", "Y", "R", "Q" }