cvitool 1.0.783 → 1.0.785
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 +9 -1
- package/build/src/cutil.js +2 -2
- package/package.json +1 -1
- package/src/cutil.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -52,4 +52,12 @@
|
|
|
52
52
|
|
|
53
53
|
## [1.0.783] - 2025-12-02
|
|
54
54
|
### Fixed
|
|
55
|
-
- 修复正则ratio限制两位数字问题
|
|
55
|
+
- 修复正则ratio限制两位数字问题
|
|
56
|
+
|
|
57
|
+
## [1.0.784] - 2025-12-03
|
|
58
|
+
### Fixed
|
|
59
|
+
- 修复checkURLResource函数请求发生CERT_HAS_EXPIRED时抛错问题
|
|
60
|
+
|
|
61
|
+
## [1.0.785] - 2025-12-05
|
|
62
|
+
### Fixed
|
|
63
|
+
- 修复validate函数string类型传空格可以通过问题
|
package/build/src/cutil.js
CHANGED
|
@@ -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', 'ECONNREFUSED'].includes(e.code)) {
|
|
366
|
+
if (e.name !== 'statusCodeError' && !['ENOTFOUND', 'ECONNREFUSED', 'CERT_HAS_EXPIRED'].includes(e.code)) {
|
|
367
367
|
throw e;
|
|
368
368
|
}
|
|
369
369
|
obj.isEffective = false;
|
|
@@ -445,7 +445,7 @@ function validate(value, rule, finalFunc) {
|
|
|
445
445
|
result.pass = false;
|
|
446
446
|
return result;
|
|
447
447
|
}
|
|
448
|
-
if ((type === 'string' && !allowEmpty && fieldValue === '') ||
|
|
448
|
+
if ((type === 'string' && !allowEmpty && fieldValue.trim() === '') ||
|
|
449
449
|
(type === 'array' && !allowEmpty && fieldValue.length === 0) ||
|
|
450
450
|
(type === 'object' && !allowEmpty && Object.keys(fieldValue).length === 0)) {
|
|
451
451
|
result.message = 'field value can not empty';
|
package/package.json
CHANGED
package/src/cutil.ts
CHANGED
|
@@ -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', 'ECONNREFUSED'].includes(e.code)) {
|
|
402
|
+
if (e.name !== 'statusCodeError' && !['ENOTFOUND', 'ECONNREFUSED', 'CERT_HAS_EXPIRED'].includes(e.code)) {
|
|
403
403
|
throw e;
|
|
404
404
|
}
|
|
405
405
|
obj.isEffective = false;
|
|
@@ -487,7 +487,7 @@ function validate(value: { [key: string]: any }, rule: { [key: string]: validate
|
|
|
487
487
|
return result;
|
|
488
488
|
}
|
|
489
489
|
if (
|
|
490
|
-
(type === 'string' && !allowEmpty && fieldValue === '') ||
|
|
490
|
+
(type === 'string' && !allowEmpty && (fieldValue as string).trim() === '') ||
|
|
491
491
|
(type === 'array' && !allowEmpty && (fieldValue as any[]).length === 0) ||
|
|
492
492
|
(type === 'object' && !allowEmpty && Object.keys(fieldValue).length === 0)
|
|
493
493
|
) {
|