2017-08-23 14:19:04 +00: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,
|
2017-11-15 06:35:15 +00:00
|
|
|
emoji: match[0],
|
2017-08-23 14:19:04 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2019-11-16 17:24:03 +00:00
|
|
|
export default findEmoji;
|