mirror of
https://github.com/thelounge/thelounge
synced 2024-12-24 19:33:07 +00:00
1dc92d8934
¯\_(ツ)_/¯
20 lines
321 B
JavaScript
20 lines
321 B
JavaScript
"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;
|