thelounge/client/js/libs/handlebars/ircmessageparser/findEmoji.js

21 lines
320 B
JavaScript
Raw Normal View History

2017-08-23 16:19:04 +02:00
"use strict";
const emojiRegExp = require("emoji-regex")();
function findEmoji(text) {
const result = [];
let match;
while ((match = emojiRegExp.exec(text))) {
result.push({
start: match.index,
end: match.index + match[0].length,
emoji: match[0]
});
}
return result;
}
module.exports = findEmoji;