fix(generator): utils.is_empty
This commit is contained in:
parent
fc9e26b9c9
commit
0b71a76b34
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue