sanitizers.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { CustomSanitizer } from '../base';
  2. import * as Options from '../options';
  3. export interface Sanitizers<Return> {
  4. /**
  5. * Adds a custom sanitizer to the validation chain.
  6. *
  7. * @param sanitizer the custom sanitizer
  8. * @returns the current validation chain
  9. */
  10. customSanitizer(sanitizer: CustomSanitizer): Return;
  11. /**
  12. * Replaces the value of the field if it's one of `''`, `null`, `undefined` or `NaN`.
  13. *
  14. * @param default_value the value to replace with
  15. * @returns the current validation chain
  16. */
  17. default(default_value: any): Return;
  18. /**
  19. * Replaces a field's value with another value.
  20. *
  21. * @param values_to_replace one or more values that should be replaced
  22. * @param new_value the value to replace with
  23. * @returns the current validation chain
  24. */
  25. replace(values_to_replace: any, new_value: any): Return;
  26. blacklist(chars: string): Return;
  27. escape(): Return;
  28. unescape(): Return;
  29. ltrim(chars?: string): Return;
  30. normalizeEmail(options?: Options.NormalizeEmailOptions): Return;
  31. rtrim(chars?: string): Return;
  32. stripLow(keep_new_lines?: boolean): Return;
  33. toArray(): Return;
  34. toBoolean(strict?: boolean): Return;
  35. toDate(): Return;
  36. toFloat(): Return;
  37. toInt(radix?: number): Return;
  38. toLowerCase(): Return;
  39. toUpperCase(): Return;
  40. trim(chars?: string): Return;
  41. whitelist(chars: string): Return;
  42. }