cvitool 1.0.781 → 1.0.783

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -44,4 +44,12 @@
44
44
 
45
45
  ## [1.0.781] - 2025-11-19
46
46
  ### Fixed
47
- - 修复validate函数校验number类型时值为NaN或正负无穷大时误判问题
47
+ - 修复validate函数校验number类型时值为NaN或正负无穷大时误判问题
48
+
49
+ ## [1.0.782] - 2025-11-19
50
+ ### Fixed
51
+ - 修复checkURLResource函数报错code为ECONNREFUSED时抛错问题
52
+
53
+ ## [1.0.783] - 2025-12-02
54
+ ### Fixed
55
+ - 修复正则ratio限制两位数字问题
@@ -45,7 +45,7 @@ const RegStr = {
45
45
  mobilePhoneNumber: '^1[3-9]\\d{9}$',
46
46
  idNumber: '^\\d{17}[\\dXx]$',
47
47
  mongoId: '^[a-f\\d]{24}$',
48
- ratio: '^[1-9]\\d?:[1-9]\\d?$',
48
+ ratio: '^[1-9]\\d*:[1-9]\\d*$',
49
49
  date: '^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$',
50
50
  time: '^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$',
51
51
  dateTime: '^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01]) ([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$',
@@ -363,7 +363,7 @@ function checkURLResource(url, timeout) {
363
363
  res.resBody.destroy();
364
364
  }
365
365
  catch (e) {
366
- if (e.name !== 'statusCodeError' && !['ENOTFOUND'].includes(e.code)) {
366
+ if (e.name !== 'statusCodeError' && !['ENOTFOUND', 'ECONNREFUSED'].includes(e.code)) {
367
367
  throw e;
368
368
  }
369
369
  obj.isEffective = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cvitool",
3
- "version": "1.0.781",
3
+ "version": "1.0.783",
4
4
  "description": "cvitool",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/cutil.ts CHANGED
@@ -83,7 +83,7 @@ const RegStr = {
83
83
  mobilePhoneNumber: '^1[3-9]\\d{9}$',
84
84
  idNumber: '^\\d{17}[\\dXx]$',
85
85
  mongoId: '^[a-f\\d]{24}$',
86
- ratio: '^[1-9]\\d?:[1-9]\\d?$',
86
+ ratio: '^[1-9]\\d*:[1-9]\\d*$',
87
87
  date: '^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$',
88
88
  time: '^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$',
89
89
  dateTime: '^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01]) ([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$',
@@ -399,7 +399,7 @@ async function checkURLResource(url: string, timeout?: number) {
399
399
  const res = await hgo.get(url, { resType: 'stream', timeout });
400
400
  (res.resBody as Readable).destroy();
401
401
  } catch (e) {
402
- if (e.name !== 'statusCodeError' && !['ENOTFOUND'].includes(e.code)) {
402
+ if (e.name !== 'statusCodeError' && !['ENOTFOUND', 'ECONNREFUSED'].includes(e.code)) {
403
403
  throw e;
404
404
  }
405
405
  obj.isEffective = false;