2020-03-27 13:59:38 -07:00
|
|
|
// A mapping of unicode strings to an object containing the filename
|
|
|
|
// (i.e. the svg filename) and a shortCode intended to be shown
|
|
|
|
// as a "title" attribute in an HTML element (aka tooltip).
|
|
|
|
|
|
|
|
const [
|
|
|
|
shortCodesToEmojiData,
|
2022-05-02 07:00:50 -07:00
|
|
|
skins, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
|
|
categories, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
|
|
short_names, // eslint-disable-line @typescript-eslint/no-unused-vars
|
2020-03-27 13:59:38 -07:00
|
|
|
emojisWithoutShortCodes,
|
2022-11-15 09:23:36 -08:00
|
|
|
] = require('./emoji-compressed');
|
|
|
|
const { unicodeToFilename } = require('./unicode-to-filename');
|
2020-03-27 13:59:38 -07:00
|
|
|
|
|
|
|
// decompress
|
|
|
|
const unicodeMapping = {};
|
|
|
|
|
|
|
|
function processEmojiMapData(emojiMapData, shortCode) {
|
2021-08-03 10:10:42 -07:00
|
|
|
const [ native, filename ] = emojiMapData;
|
|
|
|
|
2020-03-27 13:59:38 -07:00
|
|
|
unicodeMapping[native] = {
|
2021-08-03 10:10:42 -07:00
|
|
|
shortCode,
|
|
|
|
filename: filename || unicodeToFilename(native),
|
2020-03-27 13:59:38 -07:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
Object.keys(shortCodesToEmojiData).forEach((shortCode) => {
|
2021-08-03 10:10:42 -07:00
|
|
|
const [ filenameData ] = shortCodesToEmojiData[shortCode];
|
2020-03-27 13:59:38 -07:00
|
|
|
filenameData.forEach(emojiMapData => processEmojiMapData(emojiMapData, shortCode));
|
|
|
|
});
|
|
|
|
emojisWithoutShortCodes.forEach(emojiMapData => processEmojiMapData(emojiMapData));
|
|
|
|
|
|
|
|
module.exports = unicodeMapping;
|