bguard 0.0.2 → 0.0.4

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.
Files changed (121) hide show
  1. package/lib/CommonSchema-DeTBsQhn.d.mts +57 -0
  2. package/lib/CommonSchema-DeTBsQhn.d.ts +57 -0
  3. package/lib/asserts/array/index.d.mts +2 -0
  4. package/lib/asserts/array/index.d.ts +2 -0
  5. package/lib/asserts/array/index.js +90 -0
  6. package/lib/asserts/array/index.js.map +1 -0
  7. package/lib/asserts/array/index.mjs +63 -0
  8. package/lib/asserts/array/index.mjs.map +1 -0
  9. package/lib/asserts/boolean/index.d.mts +2 -0
  10. package/lib/asserts/boolean/index.d.ts +2 -0
  11. package/lib/asserts/boolean/index.js +118 -0
  12. package/lib/asserts/boolean/index.js.map +1 -0
  13. package/lib/asserts/boolean/index.mjs +91 -0
  14. package/lib/asserts/boolean/index.mjs.map +1 -0
  15. package/lib/asserts/common/equalTo.d.mts +29 -0
  16. package/lib/asserts/common/equalTo.d.ts +29 -0
  17. package/lib/asserts/common/equalTo.js +54 -0
  18. package/lib/asserts/common/equalTo.js.map +1 -0
  19. package/lib/asserts/common/equalTo.mjs +27 -0
  20. package/lib/asserts/common/equalTo.mjs.map +1 -0
  21. package/lib/asserts/common/index.d.mts +18 -0
  22. package/lib/asserts/common/index.d.ts +18 -0
  23. package/lib/asserts/common/index.js +72 -0
  24. package/lib/asserts/common/index.js.map +1 -0
  25. package/lib/asserts/common/index.mjs +45 -0
  26. package/lib/asserts/common/index.mjs.map +1 -0
  27. package/lib/asserts/number/index.d.mts +2 -0
  28. package/lib/asserts/number/index.d.ts +2 -0
  29. package/lib/asserts/number/index.js +112 -0
  30. package/lib/asserts/number/index.js.map +1 -0
  31. package/lib/asserts/number/index.mjs +85 -0
  32. package/lib/asserts/number/index.mjs.map +1 -0
  33. package/lib/asserts/number/max.d.mts +17 -0
  34. package/lib/asserts/number/max.d.ts +17 -0
  35. package/lib/asserts/number/max.js +54 -0
  36. package/lib/asserts/number/max.js.map +1 -0
  37. package/lib/asserts/number/max.mjs +27 -0
  38. package/lib/asserts/number/max.mjs.map +1 -0
  39. package/lib/asserts/number/maxExcluded.d.mts +17 -0
  40. package/lib/asserts/number/maxExcluded.d.ts +17 -0
  41. package/lib/asserts/number/maxExcluded.js +54 -0
  42. package/lib/asserts/number/maxExcluded.js.map +1 -0
  43. package/lib/asserts/number/maxExcluded.mjs +27 -0
  44. package/lib/asserts/number/maxExcluded.mjs.map +1 -0
  45. package/lib/asserts/number/min.d.mts +17 -0
  46. package/lib/asserts/number/min.d.ts +17 -0
  47. package/lib/asserts/number/min.js +54 -0
  48. package/lib/asserts/number/min.js.map +1 -0
  49. package/lib/asserts/number/min.mjs +27 -0
  50. package/lib/asserts/number/min.mjs.map +1 -0
  51. package/lib/asserts/number/minExcluded.d.mts +17 -0
  52. package/lib/asserts/number/minExcluded.d.ts +17 -0
  53. package/lib/asserts/number/minExcluded.js +54 -0
  54. package/lib/asserts/number/minExcluded.js.map +1 -0
  55. package/lib/asserts/number/minExcluded.mjs +27 -0
  56. package/lib/asserts/number/minExcluded.mjs.map +1 -0
  57. package/lib/asserts/number/negative.d.mts +16 -0
  58. package/lib/asserts/number/negative.d.ts +16 -0
  59. package/lib/asserts/number/negative.js +53 -0
  60. package/lib/asserts/number/negative.js.map +1 -0
  61. package/lib/asserts/number/negative.mjs +26 -0
  62. package/lib/asserts/number/negative.mjs.map +1 -0
  63. package/lib/asserts/number/positive.d.mts +16 -0
  64. package/lib/asserts/number/positive.d.ts +16 -0
  65. package/lib/asserts/number/positive.js +53 -0
  66. package/lib/asserts/number/positive.js.map +1 -0
  67. package/lib/asserts/number/positive.mjs +26 -0
  68. package/lib/asserts/number/positive.mjs.map +1 -0
  69. package/lib/asserts/object/index.d.mts +2 -0
  70. package/lib/asserts/object/index.d.ts +2 -0
  71. package/lib/asserts/object/index.js +94 -0
  72. package/lib/asserts/object/index.js.map +1 -0
  73. package/lib/asserts/object/index.mjs +67 -0
  74. package/lib/asserts/object/index.mjs.map +1 -0
  75. package/lib/asserts/string/email.d.mts +16 -0
  76. package/lib/asserts/string/email.d.ts +16 -0
  77. package/lib/asserts/string/email.js +55 -0
  78. package/lib/asserts/string/email.js.map +1 -0
  79. package/lib/asserts/string/email.mjs +28 -0
  80. package/lib/asserts/string/email.mjs.map +1 -0
  81. package/lib/asserts/string/index.d.mts +2 -0
  82. package/lib/asserts/string/index.d.ts +2 -0
  83. package/lib/asserts/string/index.js +112 -0
  84. package/lib/asserts/string/index.js.map +1 -0
  85. package/lib/asserts/string/index.mjs +85 -0
  86. package/lib/asserts/string/index.mjs.map +1 -0
  87. package/lib/asserts/string/maxLength.d.mts +16 -0
  88. package/lib/asserts/string/maxLength.d.ts +16 -0
  89. package/lib/asserts/string/maxLength.js +54 -0
  90. package/lib/asserts/string/maxLength.js.map +1 -0
  91. package/lib/asserts/string/maxLength.mjs +27 -0
  92. package/lib/asserts/string/maxLength.mjs.map +1 -0
  93. package/lib/asserts/string/minLength.d.mts +16 -0
  94. package/lib/asserts/string/minLength.d.ts +16 -0
  95. package/lib/asserts/string/minLength.js +54 -0
  96. package/lib/asserts/string/minLength.js.map +1 -0
  97. package/lib/asserts/string/minLength.mjs +27 -0
  98. package/lib/asserts/string/minLength.mjs.map +1 -0
  99. package/lib/asserts/string/regExp.d.mts +16 -0
  100. package/lib/asserts/string/regExp.d.ts +16 -0
  101. package/lib/asserts/string/regExp.js +54 -0
  102. package/lib/asserts/string/regExp.js.map +1 -0
  103. package/lib/asserts/string/regExp.mjs +27 -0
  104. package/lib/asserts/string/regExp.mjs.map +1 -0
  105. package/lib/index-B1yBez0g.d.ts +39 -0
  106. package/lib/index-B63cXDOm.d.mts +32 -0
  107. package/lib/index-BEyBEBSm.d.ts +32 -0
  108. package/lib/index-CK_g_aEC.d.ts +32 -0
  109. package/lib/index-D3R2euaT.d.mts +29 -0
  110. package/lib/index-DPkImfCy.d.ts +29 -0
  111. package/lib/index-DitgsWDO.d.ts +27 -0
  112. package/lib/index-T3KBmyyn.d.mts +27 -0
  113. package/lib/index-aBEYpJdZ.d.mts +32 -0
  114. package/lib/index-nzqBrOHf.d.mts +39 -0
  115. package/lib/index.d.mts +52 -0
  116. package/lib/index.d.ts +52 -0
  117. package/lib/index.js +295 -0
  118. package/lib/index.js.map +1 -0
  119. package/lib/index.mjs +262 -0
  120. package/lib/index.mjs.map +1 -0
  121. package/package.json +39 -3
@@ -0,0 +1,27 @@
1
+ // src/exceptions.ts
2
+ var ValidationError = class extends Error {
3
+ expected;
4
+ received;
5
+ pathToError;
6
+ message;
7
+ constructor(expected, received, pathToError, message) {
8
+ super();
9
+ this.expected = expected;
10
+ this.received = received;
11
+ this.pathToError = pathToError;
12
+ this.message = message;
13
+ }
14
+ };
15
+ function throwException(expected, received, pathToError, message) {
16
+ throw new ValidationError(expected, received, pathToError, message);
17
+ }
18
+
19
+ // src/asserts/number/max.ts
20
+ var max = (expected) => (received, pathToError) => {
21
+ if (expected < received)
22
+ throwException(expected, received, pathToError, "The received value is greater than expected");
23
+ };
24
+ export {
25
+ max
26
+ };
27
+ //# sourceMappingURL=max.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/exceptions.ts","../../../src/asserts/number/max.ts"],"sourcesContent":["export class ValidationError extends Error {\n expected: unknown;\n received: unknown;\n pathToError: string;\n message: string;\n constructor(expected: unknown, received: unknown, pathToError: string, message: string) {\n super();\n this.expected = expected;\n this.received = received;\n this.pathToError = pathToError;\n this.message = message;\n }\n}\n\nexport class BuildSchemaError extends Error {}\n\nexport function throwException(expected: unknown, received: unknown, pathToError: string, message: string): never {\n throw new ValidationError(expected, received, pathToError, message);\n}\n","import { throwException } from '../../exceptions';\nimport type { RequiredValidation } from '../../schemas/CommonSchema';\n\n/**\n * Asserts that a number value does not exceed a specified maximum value.\n *\n * @param {number} expected - The maximum allowable value.\n * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value exceeds the expected maximum value.\n *\n * @example\n * const schema = number().custom(max(100));\n * parseSchema(schema, 99); // Valid\n * parseSchema(schema, 100); // Valid\n * parseSchema(schema, 101); // Throws an error: 'The received value is greater than expected'\n */\nexport const max =\n (expected: number): RequiredValidation =>\n (received: number, pathToError: string) => {\n if (expected < received)\n throwException(expected, received, pathToError, 'The received value is greater than expected');\n };\n"],"mappings":";AAAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,UAAmB,UAAmB,aAAqB,SAAiB;AACtF,UAAM;AACN,SAAK,WAAW;AAChB,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,UAAU;AAAA,EACjB;AACF;AAIO,SAAS,eAAe,UAAmB,UAAmB,aAAqB,SAAwB;AAChH,QAAM,IAAI,gBAAgB,UAAU,UAAU,aAAa,OAAO;AACpE;;;ACHO,IAAM,MACX,CAAC,aACD,CAAC,UAAkB,gBAAwB;AACzC,MAAI,WAAW;AACb,mBAAe,UAAU,UAAU,aAAa,6CAA6C;AACjG;","names":[]}
@@ -0,0 +1,17 @@
1
+ import { R as RequiredValidation } from '../../CommonSchema-DeTBsQhn.mjs';
2
+
3
+ /**
4
+ * Asserts that a number value is strictly less than a specified maximum value (i.e., the maximum value is excluded).
5
+ *
6
+ * @param {number} expected - The maximum allowable value, which is excluded.
7
+ * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is greater than or equal to the expected maximum value.
8
+ *
9
+ * @example
10
+ * const schema = number().custom(maxExcluded(100));
11
+ * parseSchema(schema, 99); // Valid
12
+ * parseSchema(schema, 100); // Throws an error: 'The received value is greater than or equal to expected'
13
+ * parseSchema(schema, 101); // Throws an error: 'The received value is greater than or equal to expected'
14
+ */
15
+ declare const maxExcluded: (expected: number) => RequiredValidation;
16
+
17
+ export { maxExcluded };
@@ -0,0 +1,17 @@
1
+ import { R as RequiredValidation } from '../../CommonSchema-DeTBsQhn.js';
2
+
3
+ /**
4
+ * Asserts that a number value is strictly less than a specified maximum value (i.e., the maximum value is excluded).
5
+ *
6
+ * @param {number} expected - The maximum allowable value, which is excluded.
7
+ * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is greater than or equal to the expected maximum value.
8
+ *
9
+ * @example
10
+ * const schema = number().custom(maxExcluded(100));
11
+ * parseSchema(schema, 99); // Valid
12
+ * parseSchema(schema, 100); // Throws an error: 'The received value is greater than or equal to expected'
13
+ * parseSchema(schema, 101); // Throws an error: 'The received value is greater than or equal to expected'
14
+ */
15
+ declare const maxExcluded: (expected: number) => RequiredValidation;
16
+
17
+ export { maxExcluded };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/asserts/number/maxExcluded.ts
21
+ var maxExcluded_exports = {};
22
+ __export(maxExcluded_exports, {
23
+ maxExcluded: () => maxExcluded
24
+ });
25
+ module.exports = __toCommonJS(maxExcluded_exports);
26
+
27
+ // src/exceptions.ts
28
+ var ValidationError = class extends Error {
29
+ expected;
30
+ received;
31
+ pathToError;
32
+ message;
33
+ constructor(expected, received, pathToError, message) {
34
+ super();
35
+ this.expected = expected;
36
+ this.received = received;
37
+ this.pathToError = pathToError;
38
+ this.message = message;
39
+ }
40
+ };
41
+ function throwException(expected, received, pathToError, message) {
42
+ throw new ValidationError(expected, received, pathToError, message);
43
+ }
44
+
45
+ // src/asserts/number/maxExcluded.ts
46
+ var maxExcluded = (expected) => (received, pathToError) => {
47
+ if (expected <= received)
48
+ throwException(expected, received, pathToError, "The received value is greater than or equal to expected");
49
+ };
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ maxExcluded
53
+ });
54
+ //# sourceMappingURL=maxExcluded.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/asserts/number/maxExcluded.ts","../../../src/exceptions.ts"],"sourcesContent":["import { throwException } from '../../exceptions';\nimport { RequiredValidation } from '../../schemas/CommonSchema';\n\n/**\n * Asserts that a number value is strictly less than a specified maximum value (i.e., the maximum value is excluded).\n *\n * @param {number} expected - The maximum allowable value, which is excluded.\n * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is greater than or equal to the expected maximum value.\n *\n * @example\n * const schema = number().custom(maxExcluded(100));\n * parseSchema(schema, 99); // Valid\n * parseSchema(schema, 100); // Throws an error: 'The received value is greater than or equal to expected'\n * parseSchema(schema, 101); // Throws an error: 'The received value is greater than or equal to expected'\n */\nexport const maxExcluded =\n (expected: number): RequiredValidation =>\n (received: number, pathToError: string) => {\n if (expected <= received)\n throwException(expected, received, pathToError, 'The received value is greater than or equal to expected');\n };\n","export class ValidationError extends Error {\n expected: unknown;\n received: unknown;\n pathToError: string;\n message: string;\n constructor(expected: unknown, received: unknown, pathToError: string, message: string) {\n super();\n this.expected = expected;\n this.received = received;\n this.pathToError = pathToError;\n this.message = message;\n }\n}\n\nexport class BuildSchemaError extends Error {}\n\nexport function throwException(expected: unknown, received: unknown, pathToError: string, message: string): never {\n throw new ValidationError(expected, received, pathToError, message);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,UAAmB,UAAmB,aAAqB,SAAiB;AACtF,UAAM;AACN,SAAK,WAAW;AAChB,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,UAAU;AAAA,EACjB;AACF;AAIO,SAAS,eAAe,UAAmB,UAAmB,aAAqB,SAAwB;AAChH,QAAM,IAAI,gBAAgB,UAAU,UAAU,aAAa,OAAO;AACpE;;;ADHO,IAAM,cACX,CAAC,aACD,CAAC,UAAkB,gBAAwB;AACzC,MAAI,YAAY;AACd,mBAAe,UAAU,UAAU,aAAa,yDAAyD;AAC7G;","names":[]}
@@ -0,0 +1,27 @@
1
+ // src/exceptions.ts
2
+ var ValidationError = class extends Error {
3
+ expected;
4
+ received;
5
+ pathToError;
6
+ message;
7
+ constructor(expected, received, pathToError, message) {
8
+ super();
9
+ this.expected = expected;
10
+ this.received = received;
11
+ this.pathToError = pathToError;
12
+ this.message = message;
13
+ }
14
+ };
15
+ function throwException(expected, received, pathToError, message) {
16
+ throw new ValidationError(expected, received, pathToError, message);
17
+ }
18
+
19
+ // src/asserts/number/maxExcluded.ts
20
+ var maxExcluded = (expected) => (received, pathToError) => {
21
+ if (expected <= received)
22
+ throwException(expected, received, pathToError, "The received value is greater than or equal to expected");
23
+ };
24
+ export {
25
+ maxExcluded
26
+ };
27
+ //# sourceMappingURL=maxExcluded.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/exceptions.ts","../../../src/asserts/number/maxExcluded.ts"],"sourcesContent":["export class ValidationError extends Error {\n expected: unknown;\n received: unknown;\n pathToError: string;\n message: string;\n constructor(expected: unknown, received: unknown, pathToError: string, message: string) {\n super();\n this.expected = expected;\n this.received = received;\n this.pathToError = pathToError;\n this.message = message;\n }\n}\n\nexport class BuildSchemaError extends Error {}\n\nexport function throwException(expected: unknown, received: unknown, pathToError: string, message: string): never {\n throw new ValidationError(expected, received, pathToError, message);\n}\n","import { throwException } from '../../exceptions';\nimport { RequiredValidation } from '../../schemas/CommonSchema';\n\n/**\n * Asserts that a number value is strictly less than a specified maximum value (i.e., the maximum value is excluded).\n *\n * @param {number} expected - The maximum allowable value, which is excluded.\n * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is greater than or equal to the expected maximum value.\n *\n * @example\n * const schema = number().custom(maxExcluded(100));\n * parseSchema(schema, 99); // Valid\n * parseSchema(schema, 100); // Throws an error: 'The received value is greater than or equal to expected'\n * parseSchema(schema, 101); // Throws an error: 'The received value is greater than or equal to expected'\n */\nexport const maxExcluded =\n (expected: number): RequiredValidation =>\n (received: number, pathToError: string) => {\n if (expected <= received)\n throwException(expected, received, pathToError, 'The received value is greater than or equal to expected');\n };\n"],"mappings":";AAAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,UAAmB,UAAmB,aAAqB,SAAiB;AACtF,UAAM;AACN,SAAK,WAAW;AAChB,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,UAAU;AAAA,EACjB;AACF;AAIO,SAAS,eAAe,UAAmB,UAAmB,aAAqB,SAAwB;AAChH,QAAM,IAAI,gBAAgB,UAAU,UAAU,aAAa,OAAO;AACpE;;;ACHO,IAAM,cACX,CAAC,aACD,CAAC,UAAkB,gBAAwB;AACzC,MAAI,YAAY;AACd,mBAAe,UAAU,UAAU,aAAa,yDAAyD;AAC7G;","names":[]}
@@ -0,0 +1,17 @@
1
+ import { R as RequiredValidation } from '../../CommonSchema-DeTBsQhn.mjs';
2
+
3
+ /**
4
+ * Asserts that a number value is not less than a specified minimum value.
5
+ *
6
+ * @param {number} expected - The minimum allowable value.
7
+ * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is less than the expected minimum value.
8
+ *
9
+ * @example
10
+ * const schema = number().custom(min(10));
11
+ * parseSchema(schema, 11); // Valid
12
+ * parseSchema(schema, 10); // Valid
13
+ * parseSchema(schema, 9); // Throws an error: 'The received value is less than expected'
14
+ */
15
+ declare const min: (expected: number) => RequiredValidation;
16
+
17
+ export { min };
@@ -0,0 +1,17 @@
1
+ import { R as RequiredValidation } from '../../CommonSchema-DeTBsQhn.js';
2
+
3
+ /**
4
+ * Asserts that a number value is not less than a specified minimum value.
5
+ *
6
+ * @param {number} expected - The minimum allowable value.
7
+ * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is less than the expected minimum value.
8
+ *
9
+ * @example
10
+ * const schema = number().custom(min(10));
11
+ * parseSchema(schema, 11); // Valid
12
+ * parseSchema(schema, 10); // Valid
13
+ * parseSchema(schema, 9); // Throws an error: 'The received value is less than expected'
14
+ */
15
+ declare const min: (expected: number) => RequiredValidation;
16
+
17
+ export { min };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/asserts/number/min.ts
21
+ var min_exports = {};
22
+ __export(min_exports, {
23
+ min: () => min
24
+ });
25
+ module.exports = __toCommonJS(min_exports);
26
+
27
+ // src/exceptions.ts
28
+ var ValidationError = class extends Error {
29
+ expected;
30
+ received;
31
+ pathToError;
32
+ message;
33
+ constructor(expected, received, pathToError, message) {
34
+ super();
35
+ this.expected = expected;
36
+ this.received = received;
37
+ this.pathToError = pathToError;
38
+ this.message = message;
39
+ }
40
+ };
41
+ function throwException(expected, received, pathToError, message) {
42
+ throw new ValidationError(expected, received, pathToError, message);
43
+ }
44
+
45
+ // src/asserts/number/min.ts
46
+ var min = (expected) => (received, pathToError) => {
47
+ if (expected > received)
48
+ throwException(expected, received, pathToError, "The received value is less than expected");
49
+ };
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ min
53
+ });
54
+ //# sourceMappingURL=min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/asserts/number/min.ts","../../../src/exceptions.ts"],"sourcesContent":["import { throwException } from '../../exceptions';\nimport type { RequiredValidation } from '../../schemas/CommonSchema';\n\n/**\n * Asserts that a number value is not less than a specified minimum value.\n *\n * @param {number} expected - The minimum allowable value.\n * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is less than the expected minimum value.\n *\n * @example\n * const schema = number().custom(min(10));\n * parseSchema(schema, 11); // Valid\n * parseSchema(schema, 10); // Valid\n * parseSchema(schema, 9); // Throws an error: 'The received value is less than expected'\n */\nexport const min =\n (expected: number): RequiredValidation =>\n (received: number, pathToError: string) => {\n if (expected > received)\n throwException(expected, received, pathToError, 'The received value is less than expected');\n };\n","export class ValidationError extends Error {\n expected: unknown;\n received: unknown;\n pathToError: string;\n message: string;\n constructor(expected: unknown, received: unknown, pathToError: string, message: string) {\n super();\n this.expected = expected;\n this.received = received;\n this.pathToError = pathToError;\n this.message = message;\n }\n}\n\nexport class BuildSchemaError extends Error {}\n\nexport function throwException(expected: unknown, received: unknown, pathToError: string, message: string): never {\n throw new ValidationError(expected, received, pathToError, message);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,UAAmB,UAAmB,aAAqB,SAAiB;AACtF,UAAM;AACN,SAAK,WAAW;AAChB,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,UAAU;AAAA,EACjB;AACF;AAIO,SAAS,eAAe,UAAmB,UAAmB,aAAqB,SAAwB;AAChH,QAAM,IAAI,gBAAgB,UAAU,UAAU,aAAa,OAAO;AACpE;;;ADHO,IAAM,MACX,CAAC,aACD,CAAC,UAAkB,gBAAwB;AACzC,MAAI,WAAW;AACb,mBAAe,UAAU,UAAU,aAAa,0CAA0C;AAC9F;","names":[]}
@@ -0,0 +1,27 @@
1
+ // src/exceptions.ts
2
+ var ValidationError = class extends Error {
3
+ expected;
4
+ received;
5
+ pathToError;
6
+ message;
7
+ constructor(expected, received, pathToError, message) {
8
+ super();
9
+ this.expected = expected;
10
+ this.received = received;
11
+ this.pathToError = pathToError;
12
+ this.message = message;
13
+ }
14
+ };
15
+ function throwException(expected, received, pathToError, message) {
16
+ throw new ValidationError(expected, received, pathToError, message);
17
+ }
18
+
19
+ // src/asserts/number/min.ts
20
+ var min = (expected) => (received, pathToError) => {
21
+ if (expected > received)
22
+ throwException(expected, received, pathToError, "The received value is less than expected");
23
+ };
24
+ export {
25
+ min
26
+ };
27
+ //# sourceMappingURL=min.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/exceptions.ts","../../../src/asserts/number/min.ts"],"sourcesContent":["export class ValidationError extends Error {\n expected: unknown;\n received: unknown;\n pathToError: string;\n message: string;\n constructor(expected: unknown, received: unknown, pathToError: string, message: string) {\n super();\n this.expected = expected;\n this.received = received;\n this.pathToError = pathToError;\n this.message = message;\n }\n}\n\nexport class BuildSchemaError extends Error {}\n\nexport function throwException(expected: unknown, received: unknown, pathToError: string, message: string): never {\n throw new ValidationError(expected, received, pathToError, message);\n}\n","import { throwException } from '../../exceptions';\nimport type { RequiredValidation } from '../../schemas/CommonSchema';\n\n/**\n * Asserts that a number value is not less than a specified minimum value.\n *\n * @param {number} expected - The minimum allowable value.\n * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is less than the expected minimum value.\n *\n * @example\n * const schema = number().custom(min(10));\n * parseSchema(schema, 11); // Valid\n * parseSchema(schema, 10); // Valid\n * parseSchema(schema, 9); // Throws an error: 'The received value is less than expected'\n */\nexport const min =\n (expected: number): RequiredValidation =>\n (received: number, pathToError: string) => {\n if (expected > received)\n throwException(expected, received, pathToError, 'The received value is less than expected');\n };\n"],"mappings":";AAAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,UAAmB,UAAmB,aAAqB,SAAiB;AACtF,UAAM;AACN,SAAK,WAAW;AAChB,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,UAAU;AAAA,EACjB;AACF;AAIO,SAAS,eAAe,UAAmB,UAAmB,aAAqB,SAAwB;AAChH,QAAM,IAAI,gBAAgB,UAAU,UAAU,aAAa,OAAO;AACpE;;;ACHO,IAAM,MACX,CAAC,aACD,CAAC,UAAkB,gBAAwB;AACzC,MAAI,WAAW;AACb,mBAAe,UAAU,UAAU,aAAa,0CAA0C;AAC9F;","names":[]}
@@ -0,0 +1,17 @@
1
+ import { R as RequiredValidation } from '../../CommonSchema-DeTBsQhn.mjs';
2
+
3
+ /**
4
+ * Asserts that a number value is strictly greater than a specified minimum value (i.e., the minimum value is excluded).
5
+ *
6
+ * @param {number} expected - The minimum allowable value, which is excluded.
7
+ * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is less than or equal to the expected minimum value.
8
+ *
9
+ * @example
10
+ * const schema = number().custom(minExcluded(10));
11
+ * parseSchema(schema, 11); // Valid
12
+ * parseSchema(schema, 10); // Throws an error: 'The received value is less than or equal to expected'
13
+ * parseSchema(schema, 9); // Throws an error: 'The received value is less than or equal to expected'
14
+ */
15
+ declare const minExcluded: (expected: number) => RequiredValidation;
16
+
17
+ export { minExcluded };
@@ -0,0 +1,17 @@
1
+ import { R as RequiredValidation } from '../../CommonSchema-DeTBsQhn.js';
2
+
3
+ /**
4
+ * Asserts that a number value is strictly greater than a specified minimum value (i.e., the minimum value is excluded).
5
+ *
6
+ * @param {number} expected - The minimum allowable value, which is excluded.
7
+ * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is less than or equal to the expected minimum value.
8
+ *
9
+ * @example
10
+ * const schema = number().custom(minExcluded(10));
11
+ * parseSchema(schema, 11); // Valid
12
+ * parseSchema(schema, 10); // Throws an error: 'The received value is less than or equal to expected'
13
+ * parseSchema(schema, 9); // Throws an error: 'The received value is less than or equal to expected'
14
+ */
15
+ declare const minExcluded: (expected: number) => RequiredValidation;
16
+
17
+ export { minExcluded };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/asserts/number/minExcluded.ts
21
+ var minExcluded_exports = {};
22
+ __export(minExcluded_exports, {
23
+ minExcluded: () => minExcluded
24
+ });
25
+ module.exports = __toCommonJS(minExcluded_exports);
26
+
27
+ // src/exceptions.ts
28
+ var ValidationError = class extends Error {
29
+ expected;
30
+ received;
31
+ pathToError;
32
+ message;
33
+ constructor(expected, received, pathToError, message) {
34
+ super();
35
+ this.expected = expected;
36
+ this.received = received;
37
+ this.pathToError = pathToError;
38
+ this.message = message;
39
+ }
40
+ };
41
+ function throwException(expected, received, pathToError, message) {
42
+ throw new ValidationError(expected, received, pathToError, message);
43
+ }
44
+
45
+ // src/asserts/number/minExcluded.ts
46
+ var minExcluded = (expected) => (received, pathToError) => {
47
+ if (expected >= received)
48
+ throwException(expected, received, pathToError, "The received value is less than or equal to expected");
49
+ };
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ minExcluded
53
+ });
54
+ //# sourceMappingURL=minExcluded.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/asserts/number/minExcluded.ts","../../../src/exceptions.ts"],"sourcesContent":["import { throwException } from '../../exceptions';\nimport { RequiredValidation } from '../../schemas/CommonSchema';\n\n/**\n * Asserts that a number value is strictly greater than a specified minimum value (i.e., the minimum value is excluded).\n *\n * @param {number} expected - The minimum allowable value, which is excluded.\n * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is less than or equal to the expected minimum value.\n *\n * @example\n * const schema = number().custom(minExcluded(10));\n * parseSchema(schema, 11); // Valid\n * parseSchema(schema, 10); // Throws an error: 'The received value is less than or equal to expected'\n * parseSchema(schema, 9); // Throws an error: 'The received value is less than or equal to expected'\n */\nexport const minExcluded =\n (expected: number): RequiredValidation =>\n (received: number, pathToError: string) => {\n if (expected >= received)\n throwException(expected, received, pathToError, 'The received value is less than or equal to expected');\n };\n","export class ValidationError extends Error {\n expected: unknown;\n received: unknown;\n pathToError: string;\n message: string;\n constructor(expected: unknown, received: unknown, pathToError: string, message: string) {\n super();\n this.expected = expected;\n this.received = received;\n this.pathToError = pathToError;\n this.message = message;\n }\n}\n\nexport class BuildSchemaError extends Error {}\n\nexport function throwException(expected: unknown, received: unknown, pathToError: string, message: string): never {\n throw new ValidationError(expected, received, pathToError, message);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,UAAmB,UAAmB,aAAqB,SAAiB;AACtF,UAAM;AACN,SAAK,WAAW;AAChB,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,UAAU;AAAA,EACjB;AACF;AAIO,SAAS,eAAe,UAAmB,UAAmB,aAAqB,SAAwB;AAChH,QAAM,IAAI,gBAAgB,UAAU,UAAU,aAAa,OAAO;AACpE;;;ADHO,IAAM,cACX,CAAC,aACD,CAAC,UAAkB,gBAAwB;AACzC,MAAI,YAAY;AACd,mBAAe,UAAU,UAAU,aAAa,sDAAsD;AAC1G;","names":[]}
@@ -0,0 +1,27 @@
1
+ // src/exceptions.ts
2
+ var ValidationError = class extends Error {
3
+ expected;
4
+ received;
5
+ pathToError;
6
+ message;
7
+ constructor(expected, received, pathToError, message) {
8
+ super();
9
+ this.expected = expected;
10
+ this.received = received;
11
+ this.pathToError = pathToError;
12
+ this.message = message;
13
+ }
14
+ };
15
+ function throwException(expected, received, pathToError, message) {
16
+ throw new ValidationError(expected, received, pathToError, message);
17
+ }
18
+
19
+ // src/asserts/number/minExcluded.ts
20
+ var minExcluded = (expected) => (received, pathToError) => {
21
+ if (expected >= received)
22
+ throwException(expected, received, pathToError, "The received value is less than or equal to expected");
23
+ };
24
+ export {
25
+ minExcluded
26
+ };
27
+ //# sourceMappingURL=minExcluded.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/exceptions.ts","../../../src/asserts/number/minExcluded.ts"],"sourcesContent":["export class ValidationError extends Error {\n expected: unknown;\n received: unknown;\n pathToError: string;\n message: string;\n constructor(expected: unknown, received: unknown, pathToError: string, message: string) {\n super();\n this.expected = expected;\n this.received = received;\n this.pathToError = pathToError;\n this.message = message;\n }\n}\n\nexport class BuildSchemaError extends Error {}\n\nexport function throwException(expected: unknown, received: unknown, pathToError: string, message: string): never {\n throw new ValidationError(expected, received, pathToError, message);\n}\n","import { throwException } from '../../exceptions';\nimport { RequiredValidation } from '../../schemas/CommonSchema';\n\n/**\n * Asserts that a number value is strictly greater than a specified minimum value (i.e., the minimum value is excluded).\n *\n * @param {number} expected - The minimum allowable value, which is excluded.\n * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is less than or equal to the expected minimum value.\n *\n * @example\n * const schema = number().custom(minExcluded(10));\n * parseSchema(schema, 11); // Valid\n * parseSchema(schema, 10); // Throws an error: 'The received value is less than or equal to expected'\n * parseSchema(schema, 9); // Throws an error: 'The received value is less than or equal to expected'\n */\nexport const minExcluded =\n (expected: number): RequiredValidation =>\n (received: number, pathToError: string) => {\n if (expected >= received)\n throwException(expected, received, pathToError, 'The received value is less than or equal to expected');\n };\n"],"mappings":";AAAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,UAAmB,UAAmB,aAAqB,SAAiB;AACtF,UAAM;AACN,SAAK,WAAW;AAChB,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,UAAU;AAAA,EACjB;AACF;AAIO,SAAS,eAAe,UAAmB,UAAmB,aAAqB,SAAwB;AAChH,QAAM,IAAI,gBAAgB,UAAU,UAAU,aAAa,OAAO;AACpE;;;ACHO,IAAM,cACX,CAAC,aACD,CAAC,UAAkB,gBAAwB;AACzC,MAAI,YAAY;AACd,mBAAe,UAAU,UAAU,aAAa,sDAAsD;AAC1G;","names":[]}
@@ -0,0 +1,16 @@
1
+ import { R as RequiredValidation } from '../../CommonSchema-DeTBsQhn.mjs';
2
+
3
+ /**
4
+ * Asserts that a number value is negative (less than zero).
5
+ *
6
+ * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is not negative.
7
+ *
8
+ * @example
9
+ * const schema = number().custom(negative());
10
+ * parseSchema(schema, -10); // Valid
11
+ * parseSchema(schema, 0); // Throws an error: 'The received value is not a negative number'
12
+ * parseSchema(schema, 5); // Throws an error: 'The received value is not a negative number'
13
+ */
14
+ declare const negative: () => RequiredValidation;
15
+
16
+ export { negative };
@@ -0,0 +1,16 @@
1
+ import { R as RequiredValidation } from '../../CommonSchema-DeTBsQhn.js';
2
+
3
+ /**
4
+ * Asserts that a number value is negative (less than zero).
5
+ *
6
+ * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is not negative.
7
+ *
8
+ * @example
9
+ * const schema = number().custom(negative());
10
+ * parseSchema(schema, -10); // Valid
11
+ * parseSchema(schema, 0); // Throws an error: 'The received value is not a negative number'
12
+ * parseSchema(schema, 5); // Throws an error: 'The received value is not a negative number'
13
+ */
14
+ declare const negative: () => RequiredValidation;
15
+
16
+ export { negative };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/asserts/number/negative.ts
21
+ var negative_exports = {};
22
+ __export(negative_exports, {
23
+ negative: () => negative
24
+ });
25
+ module.exports = __toCommonJS(negative_exports);
26
+
27
+ // src/exceptions.ts
28
+ var ValidationError = class extends Error {
29
+ expected;
30
+ received;
31
+ pathToError;
32
+ message;
33
+ constructor(expected, received, pathToError, message) {
34
+ super();
35
+ this.expected = expected;
36
+ this.received = received;
37
+ this.pathToError = pathToError;
38
+ this.message = message;
39
+ }
40
+ };
41
+ function throwException(expected, received, pathToError, message) {
42
+ throw new ValidationError(expected, received, pathToError, message);
43
+ }
44
+
45
+ // src/asserts/number/negative.ts
46
+ var negative = () => (received, pathToError) => {
47
+ if (received >= 0) throwException("negative", received, pathToError, "The received value is not a negative number");
48
+ };
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ negative
52
+ });
53
+ //# sourceMappingURL=negative.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/asserts/number/negative.ts","../../../src/exceptions.ts"],"sourcesContent":["import { throwException } from '../../exceptions';\nimport type { RequiredValidation } from '../../schemas/CommonSchema';\n\n/**\n * Asserts that a number value is negative (less than zero).\n *\n * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is not negative.\n *\n * @example\n * const schema = number().custom(negative());\n * parseSchema(schema, -10); // Valid\n * parseSchema(schema, 0); // Throws an error: 'The received value is not a negative number'\n * parseSchema(schema, 5); // Throws an error: 'The received value is not a negative number'\n */\nexport const negative = (): RequiredValidation => (received: number, pathToError: string) => {\n if (received >= 0) throwException('negative', received, pathToError, 'The received value is not a negative number');\n};\n","export class ValidationError extends Error {\n expected: unknown;\n received: unknown;\n pathToError: string;\n message: string;\n constructor(expected: unknown, received: unknown, pathToError: string, message: string) {\n super();\n this.expected = expected;\n this.received = received;\n this.pathToError = pathToError;\n this.message = message;\n }\n}\n\nexport class BuildSchemaError extends Error {}\n\nexport function throwException(expected: unknown, received: unknown, pathToError: string, message: string): never {\n throw new ValidationError(expected, received, pathToError, message);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,UAAmB,UAAmB,aAAqB,SAAiB;AACtF,UAAM;AACN,SAAK,WAAW;AAChB,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,UAAU;AAAA,EACjB;AACF;AAIO,SAAS,eAAe,UAAmB,UAAmB,aAAqB,SAAwB;AAChH,QAAM,IAAI,gBAAgB,UAAU,UAAU,aAAa,OAAO;AACpE;;;ADJO,IAAM,WAAW,MAA0B,CAAC,UAAkB,gBAAwB;AAC3F,MAAI,YAAY,EAAG,gBAAe,YAAY,UAAU,aAAa,6CAA6C;AACpH;","names":[]}
@@ -0,0 +1,26 @@
1
+ // src/exceptions.ts
2
+ var ValidationError = class extends Error {
3
+ expected;
4
+ received;
5
+ pathToError;
6
+ message;
7
+ constructor(expected, received, pathToError, message) {
8
+ super();
9
+ this.expected = expected;
10
+ this.received = received;
11
+ this.pathToError = pathToError;
12
+ this.message = message;
13
+ }
14
+ };
15
+ function throwException(expected, received, pathToError, message) {
16
+ throw new ValidationError(expected, received, pathToError, message);
17
+ }
18
+
19
+ // src/asserts/number/negative.ts
20
+ var negative = () => (received, pathToError) => {
21
+ if (received >= 0) throwException("negative", received, pathToError, "The received value is not a negative number");
22
+ };
23
+ export {
24
+ negative
25
+ };
26
+ //# sourceMappingURL=negative.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/exceptions.ts","../../../src/asserts/number/negative.ts"],"sourcesContent":["export class ValidationError extends Error {\n expected: unknown;\n received: unknown;\n pathToError: string;\n message: string;\n constructor(expected: unknown, received: unknown, pathToError: string, message: string) {\n super();\n this.expected = expected;\n this.received = received;\n this.pathToError = pathToError;\n this.message = message;\n }\n}\n\nexport class BuildSchemaError extends Error {}\n\nexport function throwException(expected: unknown, received: unknown, pathToError: string, message: string): never {\n throw new ValidationError(expected, received, pathToError, message);\n}\n","import { throwException } from '../../exceptions';\nimport type { RequiredValidation } from '../../schemas/CommonSchema';\n\n/**\n * Asserts that a number value is negative (less than zero).\n *\n * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is not negative.\n *\n * @example\n * const schema = number().custom(negative());\n * parseSchema(schema, -10); // Valid\n * parseSchema(schema, 0); // Throws an error: 'The received value is not a negative number'\n * parseSchema(schema, 5); // Throws an error: 'The received value is not a negative number'\n */\nexport const negative = (): RequiredValidation => (received: number, pathToError: string) => {\n if (received >= 0) throwException('negative', received, pathToError, 'The received value is not a negative number');\n};\n"],"mappings":";AAAO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,UAAmB,UAAmB,aAAqB,SAAiB;AACtF,UAAM;AACN,SAAK,WAAW;AAChB,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,UAAU;AAAA,EACjB;AACF;AAIO,SAAS,eAAe,UAAmB,UAAmB,aAAqB,SAAwB;AAChH,QAAM,IAAI,gBAAgB,UAAU,UAAU,aAAa,OAAO;AACpE;;;ACJO,IAAM,WAAW,MAA0B,CAAC,UAAkB,gBAAwB;AAC3F,MAAI,YAAY,EAAG,gBAAe,YAAY,UAAU,aAAa,6CAA6C;AACpH;","names":[]}
@@ -0,0 +1,16 @@
1
+ import { R as RequiredValidation } from '../../CommonSchema-DeTBsQhn.mjs';
2
+
3
+ /**
4
+ * Asserts that a number value is positive (greater than zero).
5
+ *
6
+ * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is not positive.
7
+ *
8
+ * @example
9
+ * const schema = number().custom(positive());
10
+ * parseSchema(schema, 10); // Valid
11
+ * parseSchema(schema, 0); // Throws an error: 'The received value is not a positive number'
12
+ * parseSchema(schema, -5); // Throws an error: 'The received value is not a positive number'
13
+ */
14
+ declare const positive: () => RequiredValidation;
15
+
16
+ export { positive };
@@ -0,0 +1,16 @@
1
+ import { R as RequiredValidation } from '../../CommonSchema-DeTBsQhn.js';
2
+
3
+ /**
4
+ * Asserts that a number value is positive (greater than zero).
5
+ *
6
+ * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is not positive.
7
+ *
8
+ * @example
9
+ * const schema = number().custom(positive());
10
+ * parseSchema(schema, 10); // Valid
11
+ * parseSchema(schema, 0); // Throws an error: 'The received value is not a positive number'
12
+ * parseSchema(schema, -5); // Throws an error: 'The received value is not a positive number'
13
+ */
14
+ declare const positive: () => RequiredValidation;
15
+
16
+ export { positive };