fix(generator): utils.is_empty
ci/woodpecker/pr/lint Pipeline was successful Details
ci/woodpecker/pr/build Pipeline was successful Details

This commit is contained in:
Aire-One 2022-11-06 19:19:40 +01:00
parent fc9e26b9c9
commit 0b71a76b34
2 changed files with 12 additions and 2 deletions

View File

@ -69,8 +69,14 @@ function snippets.render_records_from_Parameters(items: List<Function_Info.Param
return snippets.render_record(t.name, properties)
end
return ""
end):filter(function(p: string): boolean return #p > 0 end):concat("\n")
end):filter(function(p: string): boolean return #p > 0 end):concat("\n")
end):filter(
function (s: string): boolean
return not utils.is_empty(s)
end):concat("\n")
end):filter(
function (s: string): boolean
return not utils.is_empty(s)
end):concat("\n")
end
function snippets.render_record_functions(items: List<Function_Info.Function_Info>): string

View File

@ -43,6 +43,10 @@ function utils.capitalize(s: string): string
return (s:gsub("^%l", string.upper))
end
function utils.is_empty(s: string): boolean
return s == nil or s == ""
end
-- At some point, we should probably write a wrapper to make penlight's function work with pcalls.
function utils.do_or_fail<T>(func: function<T>(...: any): (T | nil, string), ...: any): T
local logger = require "logger"