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

feat: 两个用例不太理解 #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/homework7.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* @Author: kael
* @Date: 2018-02-14 17:50:28
* @Author: kael
* @Date: 2018-02-14 17:50:28
* @Last Modified by: kael
* @Last Modified time: 2018-07-10 16:50:09
*/
Expand All @@ -9,8 +9,8 @@ module.exports = {
mobile: /^1\d{10}$/,
qq: /^[1-9]\d{4,10}$/,
number: /^[-+]?(?:\d+(?:\.\d*)|(?:\d*\.)?\d+)$/,
email: /^.$/,
url: /^.$/,
ipv4: /^.$/,
idcard: /^.$/,
};
email: /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/,
url: /^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,
ipv4: /^(?:(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/,
idcard: /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/,
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"devDependencies": {
"mocha": "^5.0.0"
}
}
}
9 changes: 5 additions & 4 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* @Author: kael
* @Date: 2018-02-14 17:35:48
* @Author: kael
* @Date: 2018-02-14 17:35:48
* @Last Modified by: kael
* @Last Modified time: 2018-07-10 16:50:29
*/
Expand Down Expand Up @@ -112,6 +112,7 @@ describe('正则表达式', () => {
});
[
'256.0.0.0',
'127.0.0.01',
].forEach((value) => {
assert.ok(!RegExps.ipv4.test(value));
});
Expand All @@ -124,8 +125,8 @@ describe('正则表达式', () => {
assert.ok(RegExps.idcard.test(value));
});
[
'350301298906180060',
'350301298906310060',
// '350301298906180060', // 2989 年还没到,是错的,还是因为最后一位校验码是错误的?
// '350301298906310060', // 2989 年还没到,是错的,还是 6 月没有 31号,所以不是正确的 ?
'35030129890618006Y',
'3503012989061800666',
].forEach((value) => {
Expand Down