Skip to content

typeutil add is type method#77

Open
tongwei wants to merge 1 commit intomasterfrom
tongwei_typeutil
Open

typeutil add is type method#77
tongwei wants to merge 1 commit intomasterfrom
tongwei_typeutil

Conversation

@tongwei
Copy link
Contributor

@tongwei tongwei commented Dec 26, 2017

No description provided.


if val < min or (val == min and not left_closed) then
-- CJSON array
function _M.is_array(val)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用代码解释行为, 不用注释解释.

end

-- This is a excessively sparse array.
if max > safe and max > ratio * count then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你想做成严格的array判定还是想cjson那种概率的..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两种判断 is_array,用不同的函数实现吧

return false
end

function _M.check_number_range(val, min, max, opts)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我记得acid里有个专门判断range的. 你看怎么调整下位置, 都在那个里面实现还是都放这个文件里. 那个是setutil.


if type(val) ~= 'number' then
function _M.is_string_number(val)
if type(val) ~= 'string' then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以用上面定义的 is_string()

end

-- This is a excessively sparse array.
if max > safe and max > ratio * count then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两种判断 is_array,用不同的函数实现吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments