@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.
@@ -1,2 +1,3 @@
1
1
  export * from './isStringOfZeros';
2
+ export * from './isNoDoubleZeroStart';
2
3
  export * from './resetTime';
@@ -1,2 +1,3 @@
1
1
  export * from './isStringOfZeros';
2
+ export * from './isNoDoubleZeroStart';
2
3
  export * from './resetTime';
@@ -0,0 +1 @@
1
+ export * from './isNoDoubleZeroStart';
@@ -0,0 +1 @@
1
+ export * from './isNoDoubleZeroStart';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @description Используется для проверки того, что строка не начинается с '00'
3
+ */
4
+ export declare const isNoDoubleZeroStart: (str: string) => boolean;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @description Используется для проверки того, что строка не начинается с '00'
3
+ */
4
+ export const isNoDoubleZeroStart = (str) => !str.startsWith('00');
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(`Не меньше ${threshold}`),
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(`Не меньше ${threshold}`),
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(`Не больше ${threshold}`),
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(`Не больше ${threshold}`),
37
+ message: getMessage(`Не меньше ${threshold}`),
38
38
  });
39
39
  }
40
40
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/validations",
3
- "version": "3.2.1",
3
+ "version": "3.3.0",
4
4
  "browser": "./index.js",
5
5
  "main": "./index.js",
6
6
  "dependencies": {