[noImplicitAny: true] src/text

This commit is contained in:
rinsuki 2018-06-17 19:55:39 +09:00
parent 871f886702
commit 8c40917cc2
16 changed files with 166 additions and 44 deletions

View file

@ -2,7 +2,13 @@
* Emoji
*/
module.exports = text => {
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];
@ -10,5 +16,5 @@ module.exports = text => {
type: 'emoji',
content: emoji,
emoji: emoji.substr(1, emoji.length - 2)
};
};
} as TextElementEmoji;
}