summaryrefslogtreecommitdiff
path: root/stowables-dotlocal/share/nvim/site/pack/manual/start/nvim-surround-v2.1.7/lua/nvim-surround/functional.lua
blob: 450e5cf65411627b4f99118ef7949bba479e3f3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 vim.tbl_islist(t) then
        return t
    end
    return { t }
end

return M