email-match.d.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { AbstractMatchConfig, AbstractMatch } from './abstract-match';
  2. /**
  3. * @class Autolinker.match.Email
  4. * @extends Autolinker.match.AbstractMatch
  5. *
  6. * Represents a Email match found in an input string which should be Autolinked.
  7. *
  8. * See this class's superclass ({@link Autolinker.match.Match}) for more details.
  9. */
  10. export declare class EmailMatch extends AbstractMatch {
  11. /**
  12. * @public
  13. * @property {'email'} type
  14. *
  15. * A string name for the type of match that this class represents. Can be
  16. * used in a TypeScript discriminating union to type-narrow from the
  17. * `Match` type.
  18. */
  19. readonly type: 'email';
  20. /**
  21. * @cfg {String} email (required)
  22. *
  23. * The email address that was matched.
  24. */
  25. private readonly email;
  26. /**
  27. * @method constructor
  28. * @param {Object} cfg The configuration properties for the Match
  29. * instance, specified in an Object (map).
  30. */
  31. constructor(cfg: EmailMatchConfig);
  32. /**
  33. * Returns a string name for the type of match that this class represents.
  34. * For the case of EmailMatch, returns 'email'.
  35. *
  36. * @return {String}
  37. */
  38. getType(): 'email';
  39. /**
  40. * Returns the email address that was matched.
  41. *
  42. * @return {String}
  43. */
  44. getEmail(): string;
  45. /**
  46. * Returns the anchor href that should be generated for the match.
  47. *
  48. * @return {String}
  49. */
  50. getAnchorHref(): string;
  51. /**
  52. * Returns the anchor text that should be generated for the match.
  53. *
  54. * @return {String}
  55. */
  56. getAnchorText(): string;
  57. }
  58. export interface EmailMatchConfig extends AbstractMatchConfig {
  59. email: string;
  60. }