Refactoring

This commit is contained in:
syuilo
2018-08-15 20:27:49 +09:00
parent 83dcfec053
commit 08b431723a
4 changed files with 6 additions and 6 deletions

View File

@@ -9,12 +9,12 @@ export type TextElementEmoji = {
};
export default function(text: string) {
const match = text.match(/^:[a-zA-Z0-9+-_]+:/);
const match = text.match(/^:([a-zA-Z0-9+-_]+):/);
if (!match) return null;
const emoji = match[0];
return {
type: 'emoji',
content: emoji,
emoji: emoji.substr(1, emoji.length - 2)
emoji: match[1]
} as TextElementEmoji;
}