find.d.mts 839 B

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * Create regular expression instance
  3. */
  4. declare function createEmojiRegExp(regexp: string): RegExp;
  5. /**
  6. * Match
  7. */
  8. interface EmojiRegexMatch {
  9. match: string;
  10. sequence: number[];
  11. keyword: string;
  12. regexp: number;
  13. }
  14. /**
  15. * Add prev/next
  16. */
  17. interface PrevMatch {
  18. match: EmojiRegexMatch;
  19. prev: string;
  20. }
  21. interface PrevNextMatch extends PrevMatch {
  22. next: string;
  23. }
  24. /**
  25. * Find emojis in text
  26. *
  27. * Returns only one entry per match
  28. */
  29. declare function getEmojiMatchesInText(regexp: string | RegExp | (string | RegExp)[], content: string): EmojiRegexMatch[];
  30. /**
  31. * Sort emojis, get prev and next text
  32. */
  33. declare function sortEmojiMatchesInText(content: string, matches: EmojiRegexMatch[]): PrevNextMatch[];
  34. export { type EmojiRegexMatch, createEmojiRegExp, getEmojiMatchesInText, sortEmojiMatchesInText };