@astral/validations 3.2.1 → 3.3.0
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/core/utils/index.d.ts +1 -0
- package/core/utils/index.js +1 -0
- package/core/utils/isNoDoubleZeroStart/index.d.ts +1 -0
- package/core/utils/isNoDoubleZeroStart/index.js +1 -0
- package/core/utils/isNoDoubleZeroStart/isNoDoubleZeroStart.d.ts +4 -0
- package/core/utils/isNoDoubleZeroStart/isNoDoubleZeroStart.js +4 -0
- package/innIP/innIP.js +4 -1
- package/innUL/innUL.js +4 -1
- package/max/max.js +2 -2
- package/min/min.js +2 -2
- package/package.json +1 -1
package/core/utils/index.d.ts
CHANGED
package/core/utils/index.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './isNoDoubleZeroStart';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './isNoDoubleZeroStart';
|
package/innIP/innIP.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { createRule, isStringOfZeros } from '../core';
|
1
|
+
import { createRule, isNoDoubleZeroStart, isStringOfZeros, } from '../core';
|
2
2
|
import { FIRST_INN_IP_DECODING, INN_IP_ERROR_INFO, INN_IP_LENGTH, SECOND_INN_IP_DECODING, } from './constants';
|
3
3
|
const calcFirstCheckSumForInnIP = (arrSymbols) => (arrSymbols
|
4
4
|
.slice(0, -2)
|
@@ -26,6 +26,9 @@ export const innIP = (params) => createRule((value, ctx) => {
|
|
26
26
|
if (isStringOfZeros(value)) {
|
27
27
|
return createInnIPError();
|
28
28
|
}
|
29
|
+
if (!isNoDoubleZeroStart(value)) {
|
30
|
+
return createInnIPError();
|
31
|
+
}
|
29
32
|
if (value.length !== INN_IP_LENGTH) {
|
30
33
|
return createInnIPError();
|
31
34
|
}
|
package/innUL/innUL.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { createRule, isStringOfZeros } from '../core';
|
1
|
+
import { createRule, isNoDoubleZeroStart, isStringOfZeros, } from '../core';
|
2
2
|
import { INN_UL_DECODING, INN_UL_ERROR_INFO, INN_UL_LENGTH } from './constants';
|
3
3
|
const calcCheckSumForInnUl = (arrSymbols) => (arrSymbols
|
4
4
|
.slice(0, -1)
|
@@ -21,6 +21,9 @@ export const innUL = (params) => createRule((value, ctx) => {
|
|
21
21
|
if (isStringOfZeros(value)) {
|
22
22
|
return createInnUlError();
|
23
23
|
}
|
24
|
+
if (!isNoDoubleZeroStart(value)) {
|
25
|
+
return createInnUlError();
|
26
|
+
}
|
24
27
|
if (value.length !== INN_UL_LENGTH) {
|
25
28
|
return createInnUlError();
|
26
29
|
}
|
package/max/max.js
CHANGED
@@ -28,13 +28,13 @@ export function max(threshold, params) {
|
|
28
28
|
if (Array.isArray(value) && value.length > threshold) {
|
29
29
|
return ctx.createError({
|
30
30
|
code: ARRAY_MAX_ERROR_CODE,
|
31
|
-
message: getMessage(`Не
|
31
|
+
message: getMessage(`Не больше ${threshold}`),
|
32
32
|
});
|
33
33
|
}
|
34
34
|
if (typeof value === 'number' && value > threshold) {
|
35
35
|
return ctx.createError({
|
36
36
|
code: NUMBER_MAX_ERROR_CODE,
|
37
|
-
message: getMessage(`Не
|
37
|
+
message: getMessage(`Не больше ${threshold}`),
|
38
38
|
});
|
39
39
|
}
|
40
40
|
return undefined;
|
package/min/min.js
CHANGED
@@ -28,13 +28,13 @@ export function min(threshold, params) {
|
|
28
28
|
if (Array.isArray(value) && value.length < threshold) {
|
29
29
|
return ctx.createError({
|
30
30
|
code: ARRAY_MIN_ERROR_CODE,
|
31
|
-
message: getMessage(`Не
|
31
|
+
message: getMessage(`Не меньше ${threshold}`),
|
32
32
|
});
|
33
33
|
}
|
34
34
|
if (typeof value === 'number' && value < threshold) {
|
35
35
|
return ctx.createError({
|
36
36
|
code: NUMBER_MIN_ERROR_CODE,
|
37
|
-
message: getMessage(`Не
|
37
|
+
message: getMessage(`Не меньше ${threshold}`),
|
38
38
|
});
|
39
39
|
}
|
40
40
|
return undefined;
|