1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-20 06:55:41 +08:00

15 lines
330 B
Lua

local M = {}
-- Converts singular elements to lists of one element; does nothing to lists.
---@generic T
---@param t T|T[]|nil The input element.
---@return T[]|nil @The input wrapped in a list, if necessary.
M.to_list = function(t)
if not t or type(t) == "table" then
return t
end
return { t }
end
return M