From 97313df9fc96cf7dcdfd1d141f294a19d2c21c02 Mon Sep 17 00:00:00 2001 From: linyisonger Date: Wed, 11 Dec 2024 20:50:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D55=E5=BC=80=E5=A4=B4?= =?UTF-8?q?=E7=A4=BE=E4=BC=9A=E7=BB=9F=E4=B8=80=E4=BF=A1=E7=94=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=9A=84=E9=AA=8C=E8=AF=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 +++- src/lib/verify.ts | 2 +- test/verify.test.js | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b84dafb..f9b3a5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ +### 🚀v1.5.3 修复55开头社会统一信用代码的验证问题 +🔧: 修复55开头社会统一信用代码的验证问题 + ### 🚀v1.5.2 剔除3-4位的社会统一信用代码的验证 🔧: 剔除3-4位的社会统一信用代码的验证 - ### 🚀v1.5.1 修复银行卡号吗随机后计算小数问题 🔧: 修复银行卡号吗随机后计算小数问题 diff --git a/src/lib/verify.ts b/src/lib/verify.ts index a0255ef..d74d095 100644 --- a/src/lib/verify.ts +++ b/src/lib/verify.ts @@ -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 /** 行政区域代码校验不合格 */ diff --git a/test/verify.test.js b/test/verify.test.js index 7a5e3de..26aeba7 100644 --- a/test/verify.test.js +++ b/test/verify.test.js @@ -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); @@ -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); }); @@ -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); From a548d6108a57afe04ddf96eb972475078d4080f9 Mon Sep 17 00:00:00 2001 From: linyisonger Date: Wed, 11 Dec 2024 20:50:45 +0800 Subject: [PATCH 2/2] 1.5.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d553771..8592f72 100644 --- a/package.json +++ b/package.json @@ -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",