Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style(utils): simplify utils function definition #19

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions lib/resty/timerng/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ end
local _M = {}


_M.table_new = table_new
_M.table_clear = table_clear
_M.table_deepcopy = table_deepcopy


-- get average
function _M.get_avg(cur_value, cur_count, old_avg)
-- recurrence formula
Expand All @@ -53,21 +58,6 @@ function _M.get_variance(cur_value, cur_count, old_variance, old_avg)
end


function _M.table_new(narray, nhash)
return table_new(narray, nhash)
end


function _M.table_clear(tbl)
table_clear(tbl)
end


function _M.table_deepcopy(tbl)
return table_deepcopy(tbl)
end


function _M.float_compare(left, right)
local delta = left - right
if delta < -0.01 then
Expand All @@ -93,4 +83,4 @@ function _M.round(value, digits)
end


return _M
return _M