telescope-frecency.nvim/lua/telescope/_extensions/frecency/util.lua
Senghan Bright 6dd33341e7 fixes
2021-01-15 12:16:18 +01:00

27 lines
575 B
Lua

local uv = vim.loop
local util = {}
util.string_isempty = function(s)
return s == nil or s == ''
end
util.split = function(s, delimiter)
local result = {}
for match in (s .. delimiter):gmatch("(.-)" .. delimiter) do
table.insert(result, match)
end
return result
end
util.fs_stat = function(path) -- TODO: move this to new file with M
local stat = uv.fs_stat(path)
local res = {}
res.exists = stat and true or false -- TODO: this is silly
res.isdirectory = (stat and stat.type == "directory") and true or false
return res
end
return util