valgen 5.3.0 → 5.3.2

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 (172) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/cjs/core/context.js +2 -3
  3. package/cjs/core/validator.js +4 -4
  4. package/cjs/index.js +5 -5
  5. package/cjs/rules/format-rules/is-alpha.js +52 -0
  6. package/cjs/rules/format-rules/is-ascii.js +40 -0
  7. package/cjs/rules/format-rules/is-base64.js +40 -0
  8. package/cjs/rules/format-rules/is-btc-address.js +40 -0
  9. package/cjs/rules/format-rules/is-credit-card.js +40 -0
  10. package/cjs/rules/format-rules/is-decimal.js +41 -0
  11. package/cjs/rules/format-rules/is-ean.js +40 -0
  12. package/cjs/rules/format-rules/is-email.js +97 -0
  13. package/cjs/rules/format-rules/is-eth-address.js +40 -0
  14. package/cjs/rules/format-rules/is-fqdn.js +44 -0
  15. package/cjs/rules/format-rules/is-hash.js +40 -0
  16. package/cjs/rules/format-rules/is-hex-color.js +40 -0
  17. package/cjs/rules/format-rules/is-hex.js +40 -0
  18. package/cjs/rules/format-rules/is-iban.js +52 -0
  19. package/cjs/rules/format-rules/is-ip.js +52 -0
  20. package/cjs/rules/format-rules/is-issn.js +44 -0
  21. package/cjs/rules/format-rules/is-jwt.js +40 -0
  22. package/cjs/rules/format-rules/is-lowercase.js +52 -0
  23. package/cjs/rules/format-rules/is-mac-address.js +45 -0
  24. package/cjs/rules/format-rules/is-mobile-phone.js +43 -0
  25. package/cjs/rules/{is-object-id.js → format-rules/is-object-id.js} +3 -3
  26. package/cjs/rules/format-rules/is-passport-number.js +40 -0
  27. package/cjs/rules/format-rules/is-port.js +40 -0
  28. package/cjs/rules/format-rules/is-url.js +40 -0
  29. package/cjs/rules/format-rules/is-uuid.js +40 -0
  30. package/cjs/rules/format-rules/is-vat-number.js +40 -0
  31. package/cjs/rules/{is-regexp.js → format-rules/matches.js} +8 -5
  32. package/cjs/rules/index.js +49 -22
  33. package/cjs/rules/logical-rules/is-defined.js +30 -0
  34. package/cjs/rules/{is-empty.js → logical-rules/is-empty.js} +1 -1
  35. package/cjs/rules/{range.js → logical-rules/range.js} +63 -38
  36. package/cjs/rules/{is-any.js → type-rules/is-any.js} +1 -1
  37. package/cjs/rules/{is-array.js → type-rules/is-array.js} +2 -4
  38. package/cjs/rules/{is-bigint.js → type-rules/is-bigint.js} +2 -3
  39. package/cjs/rules/{is-boolean.js → type-rules/is-boolean.js} +1 -1
  40. package/cjs/rules/{is-date.js → type-rules/is-date.js} +5 -5
  41. package/cjs/rules/{is-enum.js → type-rules/is-enum.js} +6 -5
  42. package/cjs/rules/{is-integer.js → type-rules/is-integer.js} +2 -3
  43. package/cjs/rules/{is-null.js → type-rules/is-null.js} +2 -28
  44. package/cjs/rules/{is-number.js → type-rules/is-number.js} +2 -3
  45. package/cjs/rules/{is-object.js → type-rules/is-object.js} +3 -4
  46. package/cjs/rules/{is-record.js → type-rules/is-record.js} +1 -1
  47. package/cjs/rules/{is-string.js → type-rules/is-string.js} +1 -1
  48. package/cjs/rules/{is-tuple.js → type-rules/is-tuple.js} +2 -3
  49. package/cjs/rules/utility-rules/exists.js +16 -0
  50. package/cjs/rules/utility-rules/get-length.js +24 -0
  51. package/cjs/rules/utility-rules/optional.js +16 -0
  52. package/cjs/rules/{pipe.js → utility-rules/pipe.js} +1 -1
  53. package/cjs/rules/utility-rules/required.js +18 -0
  54. package/cjs/rules/{union.js → utility-rules/union.js} +2 -2
  55. package/esm/core/context.js +2 -3
  56. package/esm/core/validator.js +4 -4
  57. package/esm/index.js +3 -3
  58. package/esm/rules/format-rules/is-alpha.js +24 -0
  59. package/esm/rules/format-rules/is-ascii.js +13 -0
  60. package/esm/rules/format-rules/is-base64.js +13 -0
  61. package/esm/rules/format-rules/is-btc-address.js +13 -0
  62. package/esm/rules/format-rules/is-credit-card.js +13 -0
  63. package/esm/rules/format-rules/is-decimal.js +14 -0
  64. package/esm/rules/format-rules/is-ean.js +13 -0
  65. package/esm/rules/format-rules/is-email.js +70 -0
  66. package/esm/rules/format-rules/is-eth-address.js +13 -0
  67. package/esm/rules/format-rules/is-fqdn.js +17 -0
  68. package/esm/rules/format-rules/is-hash.js +13 -0
  69. package/esm/rules/format-rules/is-hex-color.js +13 -0
  70. package/esm/rules/format-rules/is-hex.js +13 -0
  71. package/esm/rules/format-rules/is-iban.js +24 -0
  72. package/esm/rules/format-rules/is-ip.js +24 -0
  73. package/esm/rules/format-rules/is-issn.js +17 -0
  74. package/esm/rules/format-rules/is-jwt.js +13 -0
  75. package/esm/rules/format-rules/is-lowercase.js +24 -0
  76. package/esm/rules/format-rules/is-mac-address.js +18 -0
  77. package/esm/rules/format-rules/is-mobile-phone.js +16 -0
  78. package/esm/rules/{is-object-id.js → format-rules/is-object-id.js} +3 -3
  79. package/esm/rules/format-rules/is-passport-number.js +13 -0
  80. package/esm/rules/format-rules/is-port.js +13 -0
  81. package/esm/rules/format-rules/is-url.js +13 -0
  82. package/esm/rules/format-rules/is-uuid.js +13 -0
  83. package/esm/rules/format-rules/is-vat-number.js +13 -0
  84. package/esm/rules/{is-regexp.js → format-rules/matches.js} +6 -3
  85. package/esm/rules/index.js +49 -22
  86. package/esm/rules/logical-rules/is-defined.js +25 -0
  87. package/esm/rules/{is-empty.js → logical-rules/is-empty.js} +1 -1
  88. package/esm/rules/{range.js → logical-rules/range.js} +59 -36
  89. package/esm/rules/{is-any.js → type-rules/is-any.js} +1 -1
  90. package/esm/rules/{is-array.js → type-rules/is-array.js} +2 -4
  91. package/esm/rules/{is-bigint.js → type-rules/is-bigint.js} +2 -3
  92. package/esm/rules/{is-boolean.js → type-rules/is-boolean.js} +1 -1
  93. package/esm/rules/{is-date.js → type-rules/is-date.js} +5 -5
  94. package/esm/rules/{is-enum.js → type-rules/is-enum.js} +6 -5
  95. package/esm/rules/{is-integer.js → type-rules/is-integer.js} +2 -3
  96. package/esm/rules/{is-null.js → type-rules/is-null.js} +1 -25
  97. package/esm/rules/{is-number.js → type-rules/is-number.js} +2 -3
  98. package/esm/rules/{is-object.js → type-rules/is-object.js} +3 -4
  99. package/esm/rules/{is-record.js → type-rules/is-record.js} +1 -1
  100. package/esm/rules/{is-string.js → type-rules/is-string.js} +1 -1
  101. package/esm/rules/{is-tuple.js → type-rules/is-tuple.js} +2 -3
  102. package/esm/rules/utility-rules/exists.js +12 -0
  103. package/esm/rules/utility-rules/get-length.js +20 -0
  104. package/esm/rules/utility-rules/optional.js +12 -0
  105. package/esm/rules/{pipe.js → utility-rules/pipe.js} +1 -1
  106. package/esm/rules/utility-rules/required.js +14 -0
  107. package/esm/rules/{union.js → utility-rules/union.js} +2 -2
  108. package/package.json +3 -3
  109. package/typings/index.d.ts +4 -4
  110. package/typings/rules/format-rules/is-alpha.d.ts +11 -0
  111. package/typings/rules/format-rules/is-ascii.d.ts +6 -0
  112. package/typings/rules/format-rules/is-base64.d.ts +9 -0
  113. package/typings/rules/format-rules/is-btc-address.d.ts +6 -0
  114. package/typings/rules/format-rules/is-credit-card.d.ts +9 -0
  115. package/typings/rules/format-rules/is-decimal.d.ts +7 -0
  116. package/typings/rules/format-rules/is-ean.d.ts +6 -0
  117. package/typings/rules/format-rules/is-email.d.ts +62 -0
  118. package/typings/rules/format-rules/is-eth-address.d.ts +6 -0
  119. package/typings/rules/format-rules/is-fqdn.d.ts +13 -0
  120. package/typings/rules/format-rules/is-hash.d.ts +8 -0
  121. package/typings/rules/format-rules/is-hex-color.d.ts +6 -0
  122. package/typings/rules/format-rules/is-hex.d.ts +6 -0
  123. package/typings/rules/format-rules/is-iban.d.ts +11 -0
  124. package/typings/rules/format-rules/is-ip.d.ts +11 -0
  125. package/typings/rules/format-rules/is-issn.d.ts +14 -0
  126. package/typings/rules/format-rules/is-jwt.d.ts +6 -0
  127. package/typings/rules/format-rules/is-lowercase.d.ts +11 -0
  128. package/typings/rules/format-rules/is-mac-address.d.ts +21 -0
  129. package/typings/rules/format-rules/is-mobile-phone.d.ts +20 -0
  130. package/typings/rules/{is-object-id.d.ts → format-rules/is-object-id.d.ts} +2 -2
  131. package/typings/rules/format-rules/is-passport-number.d.ts +6 -0
  132. package/typings/rules/format-rules/is-port.d.ts +6 -0
  133. package/typings/rules/format-rules/is-url.d.ts +9 -0
  134. package/typings/rules/format-rules/is-uuid.d.ts +6 -0
  135. package/typings/rules/format-rules/is-vat-number.d.ts +6 -0
  136. package/typings/rules/format-rules/matches.d.ts +9 -0
  137. package/typings/rules/index.d.ts +49 -22
  138. package/typings/rules/logical-rules/is-defined.d.ts +11 -0
  139. package/typings/rules/{is-empty.d.ts → logical-rules/is-empty.d.ts} +3 -3
  140. package/typings/rules/{range.d.ts → logical-rules/range.d.ts} +14 -4
  141. package/typings/rules/type-rules/is-any.d.ts +5 -0
  142. package/typings/rules/{is-array.d.ts → type-rules/is-array.d.ts} +2 -2
  143. package/typings/rules/{is-bigint.d.ts → type-rules/is-bigint.d.ts} +2 -2
  144. package/typings/rules/{is-boolean.d.ts → type-rules/is-boolean.d.ts} +2 -2
  145. package/typings/rules/{is-date.d.ts → type-rules/is-date.d.ts} +3 -3
  146. package/typings/rules/{is-enum.d.ts → type-rules/is-enum.d.ts} +1 -1
  147. package/typings/rules/{is-integer.d.ts → type-rules/is-integer.d.ts} +2 -2
  148. package/typings/rules/type-rules/is-null.d.ts +11 -0
  149. package/typings/rules/{is-number.d.ts → type-rules/is-number.d.ts} +2 -2
  150. package/typings/rules/{is-object.d.ts → type-rules/is-object.d.ts} +1 -1
  151. package/typings/rules/{is-record.d.ts → type-rules/is-record.d.ts} +2 -2
  152. package/typings/rules/{is-string.d.ts → type-rules/is-string.d.ts} +5 -5
  153. package/typings/rules/{is-tuple.d.ts → type-rules/is-tuple.d.ts} +2 -8
  154. package/typings/rules/utility-rules/exists.d.ts +6 -0
  155. package/typings/rules/utility-rules/get-length.d.ts +11 -0
  156. package/typings/rules/utility-rules/optional.d.ts +7 -0
  157. package/typings/rules/{pipe.d.ts → utility-rules/pipe.d.ts} +1 -1
  158. package/typings/rules/utility-rules/required.d.ts +7 -0
  159. package/typings/rules/utility-rules/union.d.ts +5 -0
  160. package/cjs/rules/length.js +0 -41
  161. package/cjs/rules/optional.js +0 -44
  162. package/cjs/rules/string-formats.js +0 -377
  163. package/esm/rules/length.js +0 -35
  164. package/esm/rules/optional.js +0 -38
  165. package/esm/rules/string-formats.js +0 -322
  166. package/typings/rules/is-any.d.ts +0 -5
  167. package/typings/rules/is-null.d.ts +0 -21
  168. package/typings/rules/is-regexp.d.ts +0 -9
  169. package/typings/rules/length.d.ts +0 -21
  170. package/typings/rules/optional.d.ts +0 -17
  171. package/typings/rules/string-formats.d.ts +0 -166
  172. package/typings/rules/union.d.ts +0 -5
@@ -0,0 +1,9 @@
1
+ import * as validatorJS from 'validator';
2
+ import { ValidationOptions } from '../../core/index.js';
3
+ export interface Base64ValidatorOptions extends ValidationOptions, validatorJS.IsBase64Options {
4
+ }
5
+ /**
6
+ * Validates if value is a "Base64" string.
7
+ * @validator isBase64
8
+ */
9
+ export declare function isBase64(options?: Base64ValidatorOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,6 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Validates if value is a BTC address.
4
+ * @validator isBtcAddress
5
+ */
6
+ export declare function isBtcAddress(options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,9 @@
1
+ import * as validatorJS from 'validator';
2
+ import { ValidationOptions } from '../../core/index.js';
3
+ export interface CreditCardValidatorOptions extends ValidationOptions, validatorJS.IsCreditCardOptions {
4
+ }
5
+ /**
6
+ * Validates if value is a credit card number
7
+ * @validator isCreditCard
8
+ */
9
+ export declare function isCreditCard(options?: CreditCardValidatorOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,7 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Check if the string represents a decimal number,
4
+ * such as `0.1`, `.3`, `1.1`, `1.00003`, `4.0` etc.
5
+ * @validator isDecimal
6
+ */
7
+ export declare function isDecimal(options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,6 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Validates if value is an EAN (European Article Number)
4
+ * @validator isEAN
5
+ */
6
+ export declare function isEAN(options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,62 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ export interface IsEmailOptions extends ValidationOptions {
3
+ /**
4
+ * If set to `true`, the validator will also match `Display Name <email-address>`.
5
+ *
6
+ * @default false
7
+ */
8
+ allowDisplayName?: boolean;
9
+ /**
10
+ * If set to `true`, the validator will reject strings without the format `Display Name <email-address>`.
11
+ *
12
+ * @default false
13
+ */
14
+ requireDisplayName?: boolean;
15
+ /**
16
+ * If set to `false`, the validator will not allow any non-English UTF8 character in email address' local part.
17
+ *
18
+ * @default true
19
+ */
20
+ utf8LocalPart?: boolean;
21
+ /**
22
+ * If set to `true`, the validator will not check for the standard max length of an email.
23
+ *
24
+ * @default false
25
+ */
26
+ ignoreMaxLength?: boolean;
27
+ /**
28
+ * If set to `true`, the validator will allow IP addresses in the host part.
29
+ *
30
+ * @default false
31
+ */
32
+ allowIpDomain?: boolean;
33
+ /**
34
+ * If set to `true`, some additional validation will be enabled,
35
+ * e.g. disallowing certain syntactically valid email addresses that are rejected by GMail.
36
+ *
37
+ * @default false
38
+ */
39
+ domainSpecificValidation?: boolean;
40
+ /**
41
+ * If set to an array of strings and the part of the email after
42
+ * the @ symbol matches one of the strings defined in it,
43
+ * the validation fails.
44
+ */
45
+ hostBlacklist?: string[];
46
+ /**
47
+ * If set to an array of strings and the part of the email after
48
+ * the @ symbol matches none of the strings defined in it,
49
+ * the validation fails.
50
+ */
51
+ hostWhitelist?: string[];
52
+ /**
53
+ * If set to a string, then the validator will reject emails that include
54
+ * any of the characters in the string, in the name part.
55
+ */
56
+ blacklistedChars?: string;
57
+ }
58
+ /**
59
+ * Validates if value is a valid Email
60
+ * @validator isEmail
61
+ */
62
+ export declare function isEmail(options?: IsEmailOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,6 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Validates if value is a ETH (Ethereum) address.
4
+ * @validator isETHAddress
5
+ */
6
+ export declare function isETHAddress(options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,13 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ export interface IsFQDNOptions extends ValidationOptions {
3
+ /**
4
+ * If set to true, the validator will allow domain starting with `*.` (e.g. `*.example.com` or `*.shop.example.com`).
5
+ * @default false
6
+ */
7
+ allowWildcard?: boolean;
8
+ }
9
+ /**
10
+ * Validates if value is an FQDN
11
+ * @validator isFQDN
12
+ */
13
+ export declare function isFQDN(options?: IsFQDNOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,8 @@
1
+ import * as validatorJS from 'validator';
2
+ import { ValidationOptions } from '../../core/index.js';
3
+ export type HashAlgorithm = validatorJS.HashAlgorithm;
4
+ /**
5
+ * Validates if value a hash of type algorithm
6
+ * @validator isHash
7
+ */
8
+ export declare function isHash(algorithm: HashAlgorithm, options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,6 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Validates if value is a Hex Color
4
+ * @validator isHexColor
5
+ */
6
+ export declare function isHexColor(options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,6 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Check if the string is a hexadecimal number.
4
+ * @validator isHex
5
+ */
6
+ export declare function isHex(options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,11 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Validates if value is an IBAN (International Bank Account Number)
4
+ * @validator isIBAN
5
+ */
6
+ export declare function isIBAN(options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
7
+ /**
8
+ * Validates if value is a BIC (Bank Identification Code) or SWIFT code
9
+ * @validator isSWIFT
10
+ */
11
+ export declare function isSWIFT(options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,11 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Validates if value is an IP
4
+ * @validator isIP
5
+ */
6
+ export declare function isIP(version?: 4 | 6, options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
7
+ /**
8
+ * Validates if value is an IP
9
+ * @validator isIPRange
10
+ */
11
+ export declare function isIPRange(version?: 4 | 6, options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,14 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ export interface IsISSNOptions extends ValidationOptions {
3
+ /**
4
+ * If set to `true`, ISSNs with a lowercase `x` as the check digit are rejected.
5
+ *
6
+ * @default false
7
+ */
8
+ caseSensitive?: boolean;
9
+ }
10
+ /**
11
+ * Validates if value is an ISSN
12
+ * @validator isISSN
13
+ */
14
+ export declare function isISSN(options?: IsISSNOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,6 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Validates if value a valid JWT token
4
+ * @validator isJWT
5
+ */
6
+ export declare function isJWT(options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,11 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Validates if value a Lowercase string
4
+ * @validator isLowercase
5
+ */
6
+ export declare function isLowercase(options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
7
+ /**
8
+ * Validates if value a Uppercase string
9
+ * @validator isUppercase
10
+ */
11
+ export declare function isUppercase(options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,21 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ export interface IsMACAddressOptions extends ValidationOptions {
3
+ /**
4
+ * If set to `true`, the validator will allow MAC addresses without the colons.
5
+ * Also, it allows the use of hyphens or spaces.
6
+ *
7
+ * e.g. `01 02 03 04 05 ab` or `01-02-03-04-05-ab`.
8
+ *
9
+ * @default false
10
+ */
11
+ noSeparators?: boolean;
12
+ /**
13
+ * Setting `eui` allows for validation against EUI-48 or EUI-64 instead of both.
14
+ */
15
+ eui?: '48' | '64';
16
+ }
17
+ /**
18
+ * Validates if value is an MACAddress
19
+ * @validator isMACAddress
20
+ */
21
+ export declare function isMACAddress(options?: IsMACAddressOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,20 @@
1
+ import * as validatorJS from 'validator';
2
+ import { ValidationOptions } from '../../core/index.js';
3
+ export interface IsMobilePhoneOptions extends ValidationOptions {
4
+ /**
5
+ * If this is set to `true`, the mobile phone number must be supplied with the country code and therefore must start with `+`.
6
+ *
7
+ * @default false
8
+ */
9
+ strictMode?: boolean;
10
+ /**
11
+ * Locale or locales of the mobile phone
12
+ * @default 'any'
13
+ */
14
+ locale?: 'any' | validatorJS.MobilePhoneLocale | validatorJS.MobilePhoneLocale[];
15
+ }
16
+ /**
17
+ * Validates if value is a valid Email
18
+ * @validator isMobilePhone
19
+ */
20
+ export declare function isMobilePhone(options?: IsMobilePhoneOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../core/index.js';
1
+ import { ValidationOptions } from '../../core/index.js';
2
2
  export declare interface ObjectIdLike {
3
3
  id: string | Uint8Array;
4
4
  toHexString(): string;
@@ -7,4 +7,4 @@ export declare interface ObjectIdLike {
7
7
  * Validates if value is an "ObjectId".
8
8
  * @validator isObjectId
9
9
  */
10
- export declare function isObjectId(options?: ValidationOptions): import("../core/validator.js").Validator<string | ObjectIdLike | Uint8Array, unknown, import("../core/types.js").ExecutionOptions>;
10
+ export declare function isObjectId(options?: ValidationOptions): import("../../core/validator.js").Validator<string | ObjectIdLike | Uint8Array, unknown, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,6 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Validates if value is a passport number
4
+ * @validator isPassportNumber
5
+ */
6
+ export declare function isPassportNumber(countryCode: string, options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,6 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Validates if value is a port number
4
+ * @validator isPort
5
+ */
6
+ export declare function isPort(options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,9 @@
1
+ import * as validatorJS from 'validator';
2
+ import { ValidationOptions } from '../../core/index.js';
3
+ export interface IsURLOptions extends ValidationOptions, validatorJS.IsURLOptions {
4
+ }
5
+ /**
6
+ * Validates if value is an URL
7
+ * @validator isURL
8
+ */
9
+ export declare function isURL(options?: IsURLOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,6 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Validates if value is an "UUID".
4
+ * @validator isUUID
5
+ */
6
+ export declare function isUUID(version?: 1 | 2 | 3 | 4 | 5, options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,6 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Validates if value is an VAT number
4
+ * @validator isVAT
5
+ */
6
+ export declare function isVATNumber(countryCode: string, options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,9 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ export interface IsRegExpOptions extends ValidationOptions {
3
+ formatName?: string;
4
+ }
5
+ /**
6
+ * Coerces given value to "UUID" format or returns undefined if nullish
7
+ * @validator uuid
8
+ */
9
+ export declare function matches(format: string | RegExp, options?: IsRegExpOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
@@ -1,22 +1,49 @@
1
- export * from './is-any.js';
2
- export * from './is-array.js';
3
- export * from './is-bigint.js';
4
- export * from './is-boolean.js';
5
- export * from './is-date.js';
6
- export * from './is-empty.js';
7
- export * from './is-enum.js';
8
- export * from './is-integer.js';
9
- export * from './is-null.js';
10
- export * from './is-regexp.js';
11
- export * from './is-number.js';
12
- export * from './is-object.js';
13
- export * from './is-object-id.js';
14
- export * from './is-record.js';
15
- export * from './is-string.js';
16
- export * from './is-tuple.js';
17
- export * from './length.js';
18
- export * from './optional.js';
19
- export * from './pipe.js';
20
- export * from './range.js';
21
- export * from './string-formats.js';
22
- export * from './union.js';
1
+ export * from './type-rules/is-any.js';
2
+ export * from './type-rules/is-array.js';
3
+ export * from './type-rules/is-bigint.js';
4
+ export * from './type-rules/is-boolean.js';
5
+ export * from './type-rules/is-date.js';
6
+ export * from './type-rules/is-enum.js';
7
+ export * from './type-rules/is-integer.js';
8
+ export * from './type-rules/is-null.js';
9
+ export * from './type-rules/is-number.js';
10
+ export * from './type-rules/is-object.js';
11
+ export * from './type-rules/is-record.js';
12
+ export * from './type-rules/is-string.js';
13
+ export * from './type-rules/is-tuple.js';
14
+ export * from './format-rules/is-alpha.js';
15
+ export * from './format-rules/is-ascii.js';
16
+ export * from './format-rules/is-base64.js';
17
+ export * from './format-rules/is-btc-address.js';
18
+ export * from './format-rules/is-credit-card.js';
19
+ export * from './format-rules/is-decimal.js';
20
+ export * from './format-rules/is-ean.js';
21
+ export * from './format-rules/is-email.js';
22
+ export * from './format-rules/is-eth-address.js';
23
+ export * from './format-rules/is-fqdn.js';
24
+ export * from './format-rules/is-hash.js';
25
+ export * from './format-rules/is-hex.js';
26
+ export * from './format-rules/is-hex-color.js';
27
+ export * from './format-rules/is-iban.js';
28
+ export * from './format-rules/is-ip.js';
29
+ export * from './format-rules/is-issn.js';
30
+ export * from './format-rules/is-jwt.js';
31
+ export * from './format-rules/is-lowercase.js';
32
+ export * from './format-rules/is-mac-address.js';
33
+ export * from './format-rules/is-mobile-phone.js';
34
+ export * from './format-rules/is-object-id.js';
35
+ export * from './format-rules/is-passport-number.js';
36
+ export * from './format-rules/is-port.js';
37
+ export * from './format-rules/is-url.js';
38
+ export * from './format-rules/is-uuid.js';
39
+ export * from './format-rules/is-vat-number.js';
40
+ export * from './format-rules/matches.js';
41
+ export * from './logical-rules/is-defined.js';
42
+ export * from './logical-rules/is-empty.js';
43
+ export * from './logical-rules/range.js';
44
+ export * from './utility-rules/exists.js';
45
+ export * from './utility-rules/get-length.js';
46
+ export * from './utility-rules/optional.js';
47
+ export * from './utility-rules/pipe.js';
48
+ export * from './utility-rules/required.js';
49
+ export * from './utility-rules/union.js';
@@ -0,0 +1,11 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Validates if value is not "undefined" nor "null"
4
+ * @validator isDefined
5
+ */
6
+ export declare function isDefined(options?: ValidationOptions): import("../../core/validator.js").Validator<any, unknown, import("../../core/types.js").ExecutionOptions>;
7
+ /**
8
+ * Validates if value is "undefined"
9
+ * @validator isUndefined
10
+ */
11
+ export declare function isUndefined(options?: ValidationOptions): import("../../core/validator.js").Validator<any, unknown, import("../../core/types.js").ExecutionOptions>;
@@ -1,13 +1,13 @@
1
- import { ValidationOptions } from '../core/index.js';
1
+ import { ValidationOptions } from '../../core/index.js';
2
2
  type IsEmptyInput = string | any[] | object | Set<any> | Map<any, any>;
3
3
  /**
4
4
  * Checks if value is an empty. Value should be string, array, set, map or object
5
5
  * @validator isEmpty
6
6
  */
7
- export declare function isEmpty(options?: ValidationOptions): import("../core/validator.js").Validator<IsEmptyInput, IsEmptyInput, import("../core/types.js").ExecutionOptions>;
7
+ export declare function isEmpty(options?: ValidationOptions): import("../../core/validator.js").Validator<IsEmptyInput, IsEmptyInput, import("../../core/types.js").ExecutionOptions>;
8
8
  /**
9
9
  * Checks if value is a not empty. Value should be string, array, set, map or object
10
10
  * @validator isNotEmpty
11
11
  */
12
- export declare function isNotEmpty(options?: ValidationOptions): import("../core/validator.js").Validator<IsEmptyInput, IsEmptyInput, import("../core/types.js").ExecutionOptions>;
12
+ export declare function isNotEmpty(options?: ValidationOptions): import("../../core/validator.js").Validator<IsEmptyInput, IsEmptyInput, import("../../core/types.js").ExecutionOptions>;
13
13
  export {};
@@ -1,5 +1,10 @@
1
- import { ValidationOptions, Validator } from '../core/index.js';
1
+ import { ValidationOptions, Validator } from '../../core/index.js';
2
2
  type RangeInput = number | bigint | Date | string;
3
+ /**
4
+ * Checks if value is between minValue and maxValue
5
+ * @validator range
6
+ */
7
+ export declare function range<T extends RangeInput>(minValue: T, maxValue: T, options?: ValidationOptions): Validator<T, T, import("../../core/types.js").ExecutionOptions>;
3
8
  /**
4
9
  * Checks if value is grater than "minValue"
5
10
  * @validator iGt
@@ -41,8 +46,13 @@ export declare function isLte(maxValue: string, options?: ValidationOptions & {
41
46
  caseInsensitive?: boolean;
42
47
  }): Validator<string, string>;
43
48
  /**
44
- * Checks if value is between minValue and maxValue
45
- * @validator range
49
+ * Checks the length is at least "minValue"
50
+ * @validator lengthMin
51
+ */
52
+ export declare const lengthMin: (minValue: number) => Validator<any, any, import("../../core/types.js").ExecutionOptions>;
53
+ /**
54
+ * Checks if the length is at most "maxValue"
55
+ * @validator lengthMax
46
56
  */
47
- export declare function range<T extends RangeInput>(minValue: T, maxValue: T, options?: ValidationOptions): Validator<T, T, import("../core/types.js").ExecutionOptions>;
57
+ export declare const lengthMax: (maxValue: number) => Validator<any, any, import("../../core/types.js").ExecutionOptions>;
48
58
  export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Does nothing, just returns original input value.
3
+ * @validator isAny
4
+ */
5
+ export declare const isAny: () => import("../../core/validator.js").Validator<any, any, import("../../core/types.js").ExecutionOptions>;
@@ -1,7 +1,7 @@
1
- import { ValidationOptions, Validator } from '../core/index.js';
1
+ import { ValidationOptions, Validator } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is "array" and applies validation for each item.
4
4
  * Converts input value to array if coerce option is set to 'true'.
5
5
  * @validator isArray
6
6
  */
7
- export declare function isArray<T, I>(itemValidator?: Validator<T, I>, options?: ValidationOptions): Validator<T[], I | I[], import("../core/types.js").ExecutionOptions>;
7
+ export declare function isArray<T, I>(itemValidator?: Validator<T, I>, options?: ValidationOptions): Validator<T[], I | I[], import("../../core/types.js").ExecutionOptions>;
@@ -1,7 +1,7 @@
1
- import { ValidationOptions } from '../core/index.js';
1
+ import { ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is "BigInt".
4
4
  * Converts input value to number if coerce option is set to 'true'.
5
5
  * @validator isNumber
6
6
  */
7
- export declare function isBigint(options?: ValidationOptions): import("../core/validator.js").Validator<bigint, unknown, import("../core/types.js").ExecutionOptions>;
7
+ export declare function isBigint(options?: ValidationOptions): import("../../core/validator.js").Validator<bigint, unknown, import("../../core/types.js").ExecutionOptions>;
@@ -1,7 +1,7 @@
1
- import { ValidationOptions } from '../core/index.js';
1
+ import { ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is "boolean".
4
4
  * Converts input value to boolean if coerce option is set to 'true'.
5
5
  * @validator isBoolean
6
6
  */
7
- export declare function isBoolean(options?: ValidationOptions): import("../core/validator.js").Validator<boolean | undefined, unknown, import("../core/types.js").ExecutionOptions>;
7
+ export declare function isBoolean(options?: ValidationOptions): import("../../core/validator.js").Validator<boolean | undefined, unknown, import("../../core/types.js").ExecutionOptions>;
@@ -1,10 +1,10 @@
1
- import { ValidationOptions } from '../core/index.js';
1
+ import { ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is instance of "Date".
4
4
  * Converts input value to Date if coerce option is set to 'true'.
5
5
  * @validator isDate
6
6
  */
7
- export declare function isDate(options?: isDate.Options): import("../core/validator.js").Validator<Date, string | number | Date, import("../core/types.js").ExecutionOptions>;
7
+ export declare function isDate(options?: isDate.Options): import("../../core/validator.js").Validator<Date, string | number | Date, import("../../core/types.js").ExecutionOptions>;
8
8
  export interface IsDateStringOptions extends ValidationOptions {
9
9
  precision?: 'year' | 'month' | 'date' | 'time';
10
10
  trim?: 'date' | 'time';
@@ -14,7 +14,7 @@ export interface IsDateStringOptions extends ValidationOptions {
14
14
  * Converts input value to DFS if coerce option is set to 'true'.
15
15
  * @validator isDateString
16
16
  */
17
- export declare function isDateString(options?: IsDateStringOptions): import("../core/validator.js").Validator<string, string | number | Date, import("../core/types.js").ExecutionOptions>;
17
+ export declare function isDateString(options?: IsDateStringOptions): import("../../core/validator.js").Validator<string, string | number | Date, import("../../core/types.js").ExecutionOptions>;
18
18
  export declare namespace isDate {
19
19
  interface Options extends ValidationOptions {
20
20
  precision?: 'year' | 'month' | 'date' | 'time';
@@ -1,4 +1,4 @@
1
- import { ValidationOptions, Validator } from '../core/index.js';
1
+ import { ValidationOptions, Validator } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if given value is one of enum values.
4
4
  * @validator isEnum
@@ -1,7 +1,7 @@
1
- import { ValidationOptions } from '../core/index.js';
1
+ import { ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is "integer".
4
4
  * Converts input value to integer number if coerce option is set to 'true'.
5
5
  * @validator isInteger
6
6
  */
7
- export declare function isInteger(options?: ValidationOptions): import("../core/validator.js").Validator<number, unknown, import("../core/types.js").ExecutionOptions>;
7
+ export declare function isInteger(options?: ValidationOptions): import("../../core/validator.js").Validator<number, unknown, import("../../core/types.js").ExecutionOptions>;
@@ -0,0 +1,11 @@
1
+ import { ValidationOptions } from '../../core/index.js';
2
+ /**
3
+ * Validates if value is "null".
4
+ * @validator isNull
5
+ */
6
+ export declare function isNull(options?: ValidationOptions): import("../../core/validator.js").Validator<null, unknown, import("../../core/types.js").ExecutionOptions>;
7
+ /**
8
+ * Validates if value is "null" or "undefined".
9
+ * @validator isNull
10
+ */
11
+ export declare function isNullish(options?: ValidationOptions): import("../../core/validator.js").Validator<null, unknown, import("../../core/types.js").ExecutionOptions>;
@@ -1,7 +1,7 @@
1
- import { ValidationOptions } from '../core/index.js';
1
+ import { ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is "number".
4
4
  * Converts input value to number if coerce option is set to 'true'.
5
5
  * @validator isNumber
6
6
  */
7
- export declare function isNumber(options?: ValidationOptions): import("../core/validator.js").Validator<number, unknown, import("../core/types.js").ExecutionOptions>;
7
+ export declare function isNumber(options?: ValidationOptions): import("../../core/validator.js").Validator<number, unknown, import("../../core/types.js").ExecutionOptions>;
@@ -1,4 +1,4 @@
1
- import { Type, ValidationOptions, Validator as Validator_ } from '../core/index.js';
1
+ import { Type, ValidationOptions, Validator as Validator_ } from '../../core/index.js';
2
2
  export declare namespace IsObject {
3
3
  interface Validator<T extends object = object, I = object> extends Validator_<T, I> {
4
4
  schema: Schema;
@@ -1,7 +1,7 @@
1
- import { ValidationOptions, Validator } from '../core/index.js';
1
+ import { ValidationOptions, Validator } from '../../core/index.js';
2
2
  /**
3
3
  * Validates record object according to given "key" and "value" rules
4
4
  * Converts properties according to rules if coerce option is set to 'true'.
5
5
  * @validator isRecord
6
6
  */
7
- export declare function isRecord<TKeys extends string | number | symbol, TValues>(keyRule: Validator<TKeys>, valueRule: Validator<TValues>, options?: ValidationOptions): Validator<Record<TKeys, TValues>, Record<TKeys, TValues>, import("../core/types.js").ExecutionOptions>;
7
+ export declare function isRecord<TKeys extends string | number | symbol, TValues>(keyRule: Validator<TKeys>, valueRule: Validator<TValues>, options?: ValidationOptions): Validator<Record<TKeys, TValues>, Record<TKeys, TValues>, import("../../core/types.js").ExecutionOptions>;