Skip to content

Commit

Permalink
Changed vim.tbl_islist to vim.islist
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinKennedy committed May 18, 2024
1 parent 27eb570 commit fcc6a4a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lua/dial/util.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
-- utils
local M = {}

-- NOTE: Needed until compatibility with Neovim 0.9 is dropped
local islist = vim.fn.has('nvim-0.10') == 1 and vim.islist or vim.tbl_islist

---@generic T
---@param cond boolean
---@param branch_true T
Expand Down Expand Up @@ -38,7 +41,7 @@ end
---@param arg1 string | function
---@param arg2? string
function M.validate_list(name, list, arg1, arg2)
if not vim.tbl_islist(list) then
if not islist(list) then
error(("%s is not list."):format(name))
end

Expand Down Expand Up @@ -160,7 +163,7 @@ end
-- util.try_get_keys({foo = "bar", hoge = "fuga", teka = "pika"}, ["teka", "foo"])
-- -> ["pika", "bar"]
function M.try_get_keys(tbl, keylst)
if not vim.tbl_islist(keylst) then
if not islist(keylst) then
return nil, "the 2nd argument is not list."
end

Expand Down

0 comments on commit fcc6a4a

Please sign in to comment.