@astral/validations 3.2.2 → 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/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
|
}
|