From f412656aff6ebfe837825ce9735b6b6eae504e36 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Mon, 25 Dec 2023 11:03:34 +0800 Subject: [PATCH] style(utils): simplify utils function definition --- lib/resty/timerng/utils.lua | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/lib/resty/timerng/utils.lua b/lib/resty/timerng/utils.lua index cd83c7181..e4e2bc5ae 100644 --- a/lib/resty/timerng/utils.lua +++ b/lib/resty/timerng/utils.lua @@ -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 @@ -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 @@ -93,4 +83,4 @@ function _M.round(value, digits) end -return _M \ No newline at end of file +return _M