sanitize.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import * as express from 'express';
  2. export interface Sanitizer {
  3. blacklist(chars: string): this;
  4. customSanitizer(sanitizer: CustomSanitizer): this;
  5. escape(): this;
  6. ltrim(chars?: string): this;
  7. normalizeEmail(options?: Options.NormalizeEmailOptions): this;
  8. rtrim(chars?: string): this;
  9. stripLow(keep_new_lines?: boolean): this;
  10. toBoolean(strict?: boolean): this;
  11. toDate(): this;
  12. toFloat(): this;
  13. toInt(radix?: number): this;
  14. trim(chars?: string): this;
  15. unescape(): this;
  16. whitelist(chars: string): this;
  17. }
  18. export interface SanitizationChain extends express.RequestHandler, Sanitizer {}
  19. export interface CustomSanitizer {
  20. (value: string, options: { req: express.Request, location: string, path: string }): any;
  21. }
  22. declare namespace Options {
  23. interface NormalizeEmailOptions {
  24. all_lowercase?: boolean
  25. gmail_lowercase?: boolean
  26. gmail_remove_dots?: boolean
  27. gmail_remove_subaddress?: boolean
  28. gmail_convert_googlemaildotcom?: boolean
  29. outlookdotcom_lowercase?: boolean
  30. outlookdotcom_remove_subaddress?: boolean
  31. yahoo_lowercase?: boolean
  32. yahoo_remove_subaddress?: boolean
  33. icloud_lowercase?: boolean
  34. icloud_remove_subaddress?: boolean
  35. }
  36. }