local reap = {}

--- given lua require file path, return the base in lua path notation
--- usage example :
--- ``local BASE_PATH = reap.base_path(...)``
---@param path string ex: lib.reap.test
---@return string base_path ex: lib.reap
---@return number replacement_count ex: 1
function reap.base_path(path)
  return path:gsub('%.[^%.]+$', '')
end

--- given lua require file path, return the base in directory notation
--- usage example :
--- ``local BASE_DIR = reap.base_dir(...)``
---@param path string ex: lib.reap.test
---@return string base_dir ex: lib/reap
---@return number replacement_count ex: 1
function reap.base_dir(path)
  return reap.base_path(path):gsub("[.]", "/")
end

--- given lua require file path, return in directory notation
--- usage example :
--- ``local DIR = reap.dir(...)``
---@param path string ex: lib.reap.test
---@return string lua_dir ex: lib/reap/test
---@return number replacement_count ex: 1
function reap.dir(path)
  return path:gsub("[.]", "/")
end

return reap
