Skip to content

Commit

Permalink
chore(api): Improved vim_has function code.
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKJeff16 committed Jun 5, 2024
1 parent 0db151f commit dfcdc76
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lua/user/check/exists.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,20 @@ M = {
}

function M.vim_has(expr)
local has = vim.fn.has

if is_str(expr) then
return has(expr) == 1
return vim.fn.has(expr) == 1
end

if is_tbl(expr) and not empty(expr) then
local res = false

for _, v in next, expr do
res = M.vim_has(v)

if not res then
break
if not M.vim_has(v) then
return false
end
end

return res
return true
end

return false
Expand Down

0 comments on commit dfcdc76

Please sign in to comment.