You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
834 B
36 lines
834 B
|
2 years ago
|
/**
|
||
|
|
* Create regular expression instance
|
||
|
|
*/
|
||
|
|
declare function createEmojiRegExp(regexp: string): RegExp;
|
||
|
|
/**
|
||
|
|
* Match
|
||
|
|
*/
|
||
|
|
interface EmojiRegexMatch {
|
||
|
|
match: string;
|
||
|
|
sequence: number[];
|
||
|
|
keyword: string;
|
||
|
|
regexp: number;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Add prev/next
|
||
|
|
*/
|
||
|
|
interface PrevMatch {
|
||
|
|
match: EmojiRegexMatch;
|
||
|
|
prev: string;
|
||
|
|
}
|
||
|
|
interface PrevNextMatch extends PrevMatch {
|
||
|
|
next: string;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Find emojis in text
|
||
|
|
*
|
||
|
|
* Returns only one entry per match
|
||
|
|
*/
|
||
|
|
declare function getEmojiMatchesInText(regexp: string | RegExp | (string | RegExp)[], content: string): EmojiRegexMatch[];
|
||
|
|
/**
|
||
|
|
* Sort emojis, get prev and next text
|
||
|
|
*/
|
||
|
|
declare function sortEmojiMatchesInText(content: string, matches: EmojiRegexMatch[]): PrevNextMatch[];
|
||
|
|
|
||
|
|
export { EmojiRegexMatch, createEmojiRegExp, getEmojiMatchesInText, sortEmojiMatchesInText };
|