Skip to content

Commit

Permalink
fix: replace deprecated vim.tbl_islist by native Lua function (#323)
Browse files Browse the repository at this point in the history
* fix: replace deprecated `vim.tbl_islist` by native Lua function

This is also arguably more correct, since the previous version would also wrap non-list tables like `{ 1 = 'a', 3 = 'b' }`.

Fixes #321

---------

Co-authored-by: Kyle Chui <48545987+kylechui@users.noreply.github.com>
  • Loading branch information
clason and kylechui authored May 16, 2024
1 parent 6d0dc3d commit 38973ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/nvim-surround/functional.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local M = {}
---@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
if not t or type(t) == "table" then
return t
end
return { t }
Expand Down

0 comments on commit 38973ca

Please sign in to comment.