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

变量检查校验相关:is.js、validator 、JSVerbalExpressions #40

Open
youngwind opened this issue Mar 12, 2016 · 0 comments
Open
Labels

Comments

@youngwind
Copy link
Owner

原因

在项目实际开发中,我们常常需要重复性地解决一下两个问题。

  1. 变量是否为空?是否为空对象?是否是数组?…… (对象的类型、存在性检测)
  2. 变量是否是电话,是否是url,是否是邮箱……(变量是否满足特定的正则)

有三个工具可以让我们避免重复造轮子。

  1. is.js
  2. validator
  3. JSVerbalExpressions

1. is.js

如果我要判断一个对象是否存在的话,可不是那么容易,请参考阮一峰老师的文章
但是在is.js里面只需要一句
//todo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant