Initial commit

This commit is contained in:
2024-10-02 14:54:32 +02:00
commit 14af275c5c
27 changed files with 1871 additions and 0 deletions

13
lua/cave/option.lua Normal file
View File

@@ -0,0 +1,13 @@
---@class cave.Option
local Option
---@generic ValueType, ResultType
---@param opt ValueType?
---@param fn fun(opt: ValueType): ResultType
---@return ResultType?
function Option.map(opt, fn)
if opt == nil then return nil end
return fn(opt)
end
return Option