validator.d.ts 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. declare module 'validator' {
  2. export function contains(
  3. str: string,
  4. elem: any,
  5. options?: import('../src/options').ContainsOptions,
  6. ): boolean;
  7. export function equals(str: string, comparison: string): boolean;
  8. export function isAfter(str: string, date?: string): boolean;
  9. export function isAlpha(
  10. str: string,
  11. locale?: import('../src/options').AlphaLocale,
  12. options?: import('../src/options').IsAlphaOptions,
  13. ): boolean;
  14. export function isAlphanumeric(
  15. str: string,
  16. locale?: import('../src/options').AlphanumericLocale,
  17. ): boolean;
  18. export function isAscii(str: string): boolean;
  19. export function isBase32(str: string): boolean;
  20. export function isBase58(str: string): boolean;
  21. export function isBase64(
  22. str: string,
  23. options?: import('../src/options').IsBase64Options,
  24. ): boolean;
  25. export function isBefore(str: string, date?: string): boolean;
  26. export function isBIC(str: string): boolean;
  27. export function isBoolean(str: string): boolean;
  28. export function isBtcAddress(str: string): boolean;
  29. export function isByteLength(
  30. str: string,
  31. options: import('../src/options').MinMaxOptions,
  32. ): boolean;
  33. export function isCreditCard(str: string): boolean;
  34. export function isCurrency(
  35. str: string,
  36. options?: import('../src/options').IsCurrencyOptions,
  37. ): boolean;
  38. export function isDataURI(str: string): boolean;
  39. export function isDate(str: string, options?: import('../src/options').IsDateOptions): boolean;
  40. export function isDecimal(
  41. str: string,
  42. options?: import('../src/options').IsDecimalOptions,
  43. ): boolean;
  44. export function isDivisibleBy(str: string, number: number): boolean;
  45. export function isEAN(str: string): boolean;
  46. export function isEmail(str: string, options?: import('../src/options').IsEmailOptions): boolean;
  47. export function isEmpty(str: string, options?: import('../src/options').IsEmptyOptions): boolean;
  48. export function isEthereumAddress(str: string): boolean;
  49. export function isFQDN(str: string, options?: import('../src/options').IsFQDNOptions): boolean;
  50. export function isFloat(str: string, options?: import('../src/options').IsFloatOptions): boolean;
  51. export function isFullWidth(str: string): boolean;
  52. export function isHalfWidth(str: string): boolean;
  53. export function isHash(str: string, algorithm: import('../src/options').HashAlgorithm): boolean;
  54. export function isHexColor(str: string): boolean;
  55. export function isHexadecimal(str: string): boolean;
  56. export function isHSL(str: string): boolean;
  57. export function isIBAN(str: string): boolean;
  58. export function isIdentityCard(
  59. str: string,
  60. locale?: import('../src/options').IdentityCard,
  61. ): boolean;
  62. export function isIMEI(str: string, options?: import('../src/options').IsIMEIOptions): boolean;
  63. export function isIP(str: string, version?: import('../src/options').IPVersion): boolean;
  64. export function isIPRange(str: string): boolean;
  65. export function isISBN(str: string, version?: number): boolean;
  66. export function isISSN(str: string, options?: import('../src/options').IsISSNOptions): boolean;
  67. export function isISIN(str: string): boolean;
  68. export function isISO8601(
  69. str: string,
  70. options?: import('../src/options').IsISO8601Options,
  71. ): boolean;
  72. export function isISO31661Alpha2(str: string): boolean;
  73. export function isISO31661Alpha3(str: string): boolean;
  74. export function isISRC(str: string): boolean;
  75. export function isIn(str: string, values: any[]): boolean;
  76. export function isInt(str: string, options?: import('../src/options').IsIntOptions): boolean;
  77. export function isJSON(str: string, options?: import('../src/options').IsJSONOptions): boolean;
  78. export function isJWT(str: string): boolean;
  79. export function isLatLong(
  80. str: string,
  81. options?: import('../src/options').IsLatLongOptions,
  82. ): boolean;
  83. export function isLength(str: string, options: import('../src/options').MinMaxOptions): boolean;
  84. export function isLocale(str: string): boolean;
  85. export function isLowercase(str: string): boolean;
  86. export function isMagnetURI(str: string): boolean;
  87. export function isMACAddress(
  88. str: string,
  89. options: import('../src/options').IsMACAddressOptions,
  90. ): boolean;
  91. export function isMD5(str: string): boolean;
  92. export function isMimeType(str: string): boolean;
  93. export function isMobilePhone(
  94. str: string,
  95. locale:
  96. | import('../src/options').MobilePhoneLocale
  97. | import('../src/options').MobilePhoneLocale[],
  98. options?: import('../src/options').IsMobilePhoneOptions,
  99. ): boolean;
  100. export function isMongoId(str: string): boolean;
  101. export function isMultibyte(str: string): boolean;
  102. export function isNumeric(
  103. str: string,
  104. options?: import('../src/options').IsNumericOptions,
  105. ): boolean;
  106. export function isOctal(str: string): boolean;
  107. export function isPassportNumber(
  108. str: string,
  109. countryCode?: import('../src/options').PassportCountryCode,
  110. ): boolean;
  111. export function isPort(str: string): boolean;
  112. export function isPostalCode(
  113. str: string,
  114. locale: import('../src/options').PostalCodeLocale,
  115. ): boolean;
  116. export function isRFC3339(str: string): boolean;
  117. export function isRgbColor(str: string, includePercentValues?: boolean): boolean;
  118. export function isSemVer(str: string): boolean;
  119. export function isSlug(str: string): boolean;
  120. export function isStrongPassword(
  121. str: string,
  122. options?: import('../src/options').IsStrongPasswordOptions,
  123. ): boolean;
  124. export function isSurrogatePair(str: string): boolean;
  125. export function isTaxID(str: string, locale: import('../src/options').TaxIDLocale): boolean;
  126. export function isURL(str: string, options?: import('../src/options').IsURLOptions): boolean;
  127. export function isUUID(str: string, version?: import('../src/options').UUIDVersion): boolean;
  128. export function isUppercase(str: string): boolean;
  129. export function isVariableWidth(str: string): boolean;
  130. export function isVAT(str: string, countryCode: import('../src/options').VATCountryCode): boolean;
  131. export function isWhitelisted(str: string, chars: string | string[]): boolean;
  132. export function matches(str: string, pattern: RegExp | string, modifiers?: string): boolean;
  133. export function blacklist(str: string, chars: string): string;
  134. export function escape(str: string): string;
  135. export function unescape(str: string): string;
  136. export function ltrim(str: string, chars?: string): string;
  137. export function normalizeEmail(
  138. str: string,
  139. options?: import('../src/options').NormalizeEmailOptions,
  140. ): string;
  141. export function rtrim(str: string, chars?: string): string;
  142. export function stripLow(str: string, keep_new_lines?: boolean): string;
  143. export function toBoolean(str: string, strict?: boolean): boolean;
  144. export function toDate(str: string): Date;
  145. export function toFloat(str: string): number;
  146. export function toInt(str: string, radix?: number): string;
  147. export function trim(str: string, chars?: string): string;
  148. export function whitelist(str: string, chars: string): string;
  149. export function toString(str: string): string;
  150. }