custom-class-validator-tools 1.1.23 → 1.1.25

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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringValidator = void 0;
3
+ exports.stringValidator = stringValidator;
4
4
  function stringValidator(value, blank) {
5
5
  switch (blank ?? false) {
6
6
  case true:
@@ -10,4 +10,3 @@ function stringValidator(value, blank) {
10
10
  return typeof value === 'string' && value.length > 0;
11
11
  }
12
12
  }
13
- exports.stringValidator = stringValidator;
@@ -1,4 +1,4 @@
1
1
  import { ValidationOptions } from 'class-validator';
2
2
  export declare const IsNotEmptySqlTimeString: (validationOptions?: ValidationOptions & {
3
- format?: 'hh:mm:ss' | 'hh:mm';
3
+ format?: "hh:mm:ss" | "hh:mm";
4
4
  }) => PropertyDecorator;
@@ -1,4 +1,4 @@
1
1
  import { ValidationOptions } from 'class-validator';
2
2
  export declare const IsNullableSqlTimeString: (validationOptions?: ValidationOptions & {
3
- format?: 'hh:mm:ss' | 'hh:mm';
3
+ format?: "hh:mm:ss" | "hh:mm";
4
4
  }) => PropertyDecorator;
@@ -1,4 +1,4 @@
1
1
  import { ValidationOptions } from 'class-validator';
2
2
  export declare const IsOptionalSqlTimeString: (validationOptions?: ValidationOptions & {
3
- format?: 'hh:mm' | 'hh:mm:ss';
3
+ format?: "hh:mm" | "hh:mm:ss";
4
4
  }) => PropertyDecorator;
@@ -1,4 +1,4 @@
1
1
  import { ValidationOptions } from 'class-validator';
2
2
  export declare const IsUndefinableSQLTimeString: (validationOptions?: ValidationOptions & {
3
- format: 'hh:mm' | 'hh:mm:ss';
3
+ format: "hh:mm" | "hh:mm:ss";
4
4
  }) => PropertyDecorator;
@@ -23,11 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.validateWithHeaders = void 0;
26
+ exports.validateWithHeaders = validateWithHeaders;
27
27
  const class_validator_1 = require("class-validator");
28
28
  const FE = __importStar(require("fp-ts/Either"));
29
29
  const FF = __importStar(require("fp-ts/function"));
30
30
  function validateWithHeaders(dto) {
31
31
  return FF.pipe(FE.tryCatch(() => (0, class_validator_1.validateSync)(dto, { skipMissingProperties: false }), FE.toError), FE.fold(() => [], right => right));
32
32
  }
33
- exports.validateWithHeaders = validateWithHeaders;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isFalse = exports.isTrue = void 0;
3
+ exports.isTrue = isTrue;
4
+ exports.isFalse = isFalse;
4
5
  function isTrue(value) {
5
6
  return value;
6
7
  }
7
- exports.isTrue = isTrue;
8
8
  function isFalse(value) {
9
9
  return !value;
10
10
  }
11
- exports.isFalse = isFalse;
@@ -23,41 +23,42 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.isNotEmpty = exports.isEmpty = exports.isNotEmptyString = exports.isEmptyString = exports.isNotEmptySimple = exports.isEmptySimple = exports.isNotNull = exports.isNull = exports.isNotUndefined = exports.isUndefined = void 0;
26
+ exports.isUndefined = isUndefined;
27
+ exports.isNotUndefined = isNotUndefined;
28
+ exports.isNull = isNull;
29
+ exports.isNotNull = isNotNull;
30
+ exports.isEmptySimple = isEmptySimple;
31
+ exports.isNotEmptySimple = isNotEmptySimple;
32
+ exports.isEmptyString = isEmptyString;
33
+ exports.isNotEmptyString = isNotEmptyString;
34
+ exports.isEmpty = isEmpty;
35
+ exports.isNotEmpty = isNotEmpty;
27
36
  const FE = __importStar(require("fp-ts/Either"));
28
37
  const FF = __importStar(require("fp-ts/function"));
29
38
  function isUndefined(value) {
30
39
  return value === undefined;
31
40
  }
32
- exports.isUndefined = isUndefined;
33
41
  function isNotUndefined(value) {
34
42
  return !isUndefined(value);
35
43
  }
36
- exports.isNotUndefined = isNotUndefined;
37
44
  function isNull(value) {
38
45
  return value === null;
39
46
  }
40
- exports.isNull = isNull;
41
47
  function isNotNull(value) {
42
48
  return !isNull(value);
43
49
  }
44
- exports.isNotNull = isNotNull;
45
50
  function isEmptySimple(value) {
46
51
  return isUndefined(value) || isNull(value);
47
52
  }
48
- exports.isEmptySimple = isEmptySimple;
49
53
  function isNotEmptySimple(value) {
50
54
  return !isEmptySimple(value);
51
55
  }
52
- exports.isNotEmptySimple = isNotEmptySimple;
53
56
  function isEmptyString(value) {
54
57
  return FF.pipe(value, FE.fromNullable(true), FE.map(notNull => notNull === ''), FE.fold(left => left, right => right));
55
58
  }
56
- exports.isEmptyString = isEmptyString;
57
59
  function isNotEmptyString(value) {
58
60
  return !isEmptyString(value);
59
61
  }
60
- exports.isNotEmptyString = isNotEmptyString;
61
62
  function isEmpty(value) {
62
63
  return FF.pipe(value, FE.fromNullable(true), FE.chain(notNull => {
63
64
  return typeof notNull === 'string' && notNull === '' ? FE.left(true) : FE.right(notNull);
@@ -73,8 +74,6 @@ function isEmpty(value) {
73
74
  : FE.right(notArray);
74
75
  }), FE.fold(left => left, () => false));
75
76
  }
76
- exports.isEmpty = isEmpty;
77
77
  function isNotEmpty(value) {
78
78
  return !isEmpty(value);
79
79
  }
80
- exports.isNotEmpty = isNotEmpty;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "custom-class-validator-tools",
3
- "version": "1.1.23",
3
+ "version": "1.1.25",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",