[common] text & [web] common > scripts > text compiler: support emoji

This commit is contained in:
otofune 2017-02-28 20:33:27 +00:00
parent a7021b9514
commit 67ea1498ff
4 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,14 @@
/**
* Emoji
*/
module.exports = text => {
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)
};
};