Skip to content

Commit

Permalink
refactor(admin_gui): break the loop early and minor style clean (#9254)
Browse files Browse the repository at this point in the history
Cherry-picked from #13079

Co-authored-by: Chrono <[email protected]>
  • Loading branch information
team-gateway-bot and chronolaw authored May 27, 2024
1 parent 0b931ba commit ec7f21e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kong/admin_gui/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@

local _M = {}


-- return first listener matching filters
function _M.select_listener(listeners, filters)
for _, listener in ipairs(listeners) do
local match = true

for filter, value in pairs(filters) do
if listener[filter] ~= value then
match = false
break
end
end

if match then
return listener
end
end
end


function _M.prepare_variable(variable)
if variable == nil then
return ""
Expand All @@ -30,4 +35,5 @@ function _M.prepare_variable(variable)
return tostring(variable)
end


return _M

0 comments on commit ec7f21e

Please sign in to comment.