blob: e510b5d9121156f823c97b4758396ca20f5e81e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
/**
* Emoji
*/
export type TextElementEmoji = {
type: 'emoji'
content: string
emoji: string
};
export default function(text: string) {
const match = text.match(/^:([a-zA-Z0-9+-_]+?):/);
if (!match) return null;
const emoji = match[0];
return {
type: 'emoji',
content: emoji,
emoji: match[1]
} as TextElementEmoji;
}
|