Skip to content

Commit

Permalink
Merge pull request #36 from linyisonger/dev
Browse files Browse the repository at this point in the history
### 🚀v1.5.3 修复55开头社会统一信用代码的验证问题
  • Loading branch information
linyisonger authored Dec 11, 2024
2 parents 617eed9 + a548d61 commit 5638b41
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
### 🚀v1.5.3 修复55开头社会统一信用代码的验证问题
🔧: 修复55开头社会统一信用代码的验证问题

### 🚀v1.5.2 剔除3-4位的社会统一信用代码的验证
🔧: 剔除3-4位的社会统一信用代码的验证


### 🚀v1.5.1 修复银行卡号吗随机后计算小数问题
🔧: 修复银行卡号吗随机后计算小数问题

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@3r/tool",
"version": "1.5.2",
"version": "1.5.3",
"description": "🏃‍包含一些常用方法例如对象深克隆、递归调用、一一对比/数组交集、并集、差集/二维向量点乘、叉乘/股票KDJ、MACD、RSI、BOLL/验证为空、车牌号、邮箱、身份证、统一社会信用代码、手机号、版本对比/转换日期、星座、身份证解析、字节/随机颜色、手机号、身份证号码、统一社会信用代码...持续更新整合",
"main": "index.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class Verify {
const organizingInstitutionBarCode = usci.substring(8, 16) + '-' + usci.substring(16, 17)

/** 组织机构校验不合格 */
if (!/^((1?[1|2|3|9])|(5?[1|2|3|9])|(9?[1|2|3|9])|[2|3|4|6|7|8|A-G|Y][1])$/.test(top2)) return false
if (!/^((1?[1|2|3|9])|(5?[1|2|3|5|9])|(9?[1|2|3|9])|[2|3|4|6|7|8|A-G|Y][1])$/.test(top2)) return false
/** 省份区域代码校验不合格 */
// if (!(provinceCodes.indexOf(proCode) > 0)) return false
/** 行政区域代码校验不合格 */
Expand Down
4 changes: 3 additions & 1 deletion test/verify.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let run = function () {
console.log("校验是否是固定电话", "0371-99882211".isTellPhoneNumber);
console.log("是否是邮箱", "linyisonger@qq.com".isEmail);
// 这个验证校验码是否正确
console.log("是否是统一社会信用代码", "92230900EUFUTJY536".isUnifiedSocialCreditIdentifier);
console.log("是否是统一社会信用代码", "55420502676482337D".isUnifiedSocialCreditIdentifier);
console.log("是否是车牌号", "青G04444".isVehicleNumber);
console.log("像身份证号", "622924198810193427".likeIDCardNumber);
console.log("是否是身份证号码", "622924198810193427".isCitizenIdentificationNumber);
Expand All @@ -40,6 +40,7 @@ let run = function () {
try {
describe("验证模块", function () {
it("像是社会统一信用代码", function () {
expect(Verify.likeUsci("55420502676482337D")).toEqual(true);
expect(Verify.likeUsci("92230900EUFUTJY536")).toEqual(true);
expect("92230900EUFUTJY536".likeUsci).toEqual(true);
});
Expand All @@ -63,6 +64,7 @@ try {
expect("linyisonger@qq.com".isEmail).toEqual(true);
});
it("是否是统一社会信用代码", function () {
expect(Verify.isUnifiedSocialCreditIdentifier("55420502676482337D")).toEqual(true);
expect(Verify.isUnifiedSocialCreditIdentifier("92230900EUFUTJY536")).toEqual(true);
expect(Verify.isUnifiedSocialCreditIdentifier("92230900EUFUTJY36")).toEqual(false);
expect(Verify.isUnifiedSocialCreditIdentifier("9X30900EUFUTJY36")).toEqual(false);
Expand Down

0 comments on commit 5638b41

Please sign in to comment.