Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fibery/emoji-data

Package Overview
Dependencies
Maintainers
11
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fibery/emoji-data - npm Package Compare versions

Comparing version 2.4.0 to 2.5.0

57

lib/src/emoji-data/emoji-data.js

@@ -10,5 +10,4 @@ "use strict";

let initialized = false;
const emojis = {};
let rawEmojis = {};
let aliases = {};
const emojis = new Map();
const aliases = new Map();
let categories = [];

@@ -55,3 +54,3 @@ let nativeCategories = [];

}
emojis[formattedEmoji.id] = formattedEmoji;
emojis.set(formattedEmoji.id, formattedEmoji);
}

@@ -68,7 +67,8 @@ };

resetSearchCache();
rawEmojis = { ...data.emojis };
aliases = { ...aliases, ...data.aliases };
for (const [alias, id] of Object.entries(data.aliases)) {
aliases.set(alias, id);
}
categories = [...categories, ...data.categories];
nativeCategories = [...data.categories];
addNativeEmojis(Object.values(rawEmojis));
addNativeEmojis(Object.values(data.emojis));
};

@@ -78,13 +78,11 @@ const get = (emojiKey, { skin: fallbackSkin } = {}) => {

skin = skin || fallbackSkin || 1;
if (Object.hasOwn(aliases, id)) {
id = aliases[id];
}
const emojiData = emojis[id];
id = aliases.get(id) || id;
const emojiData = emojis.get(id);
return emojiData && "skins" in emojiData ? emojiData.skins[skin - 1] : emojiData;
};
const removeCustomEmojiFromDB = (emoji) => {
delete emojis[emoji.id];
emojis.delete(emoji.id);
if (!emoji.hidden) {
for (const shortName of emoji.shortNames) {
delete aliases[shortName];
aliases.delete(shortName);
}

@@ -96,6 +94,6 @@ }

addCustomEmojiToLookups(emoji);
emojis[emoji.id] = emoji;
emojis.set(emoji.id, emoji);
if (!emoji.hidden) {
for (const shortName of emoji.shortNames) {
aliases[shortName] = emoji.id;
aliases.set(shortName, emoji.id);
}

@@ -113,3 +111,3 @@ }

customList = newList;
const customCategories = {};
const customCategories = new Map();
for (const emoji of customList) {

@@ -119,14 +117,13 @@ addCustomEmojiToDBs(emoji);

const categoryName = emoji.customCategory || "Custom";
if (!customCategories[categoryId]) {
customCategories[categoryId] = {
id: categoryId,
name: categoryName,
emojis: [],
};
}
const category = customCategories.get(categoryId) || {
id: categoryId,
name: categoryName,
emojis: [],
};
if (!emoji.hidden) {
customCategories[categoryId].emojis.push(emoji.id);
category.emojis.push(emoji.id);
}
customCategories.set(categoryId, category);
}
const listOfCustomCategories = Object.values(customCategories);
const listOfCustomCategories = customCategories.values();
if (customList.length > 0) {

@@ -153,3 +150,3 @@ categories = [...listOfCustomCategories, ...nativeCategories];

if (value === "-" || value === "-1") {
return [emojis["-1"].skins[skinTone]];
return [emojis.get("-1").skins[skinTone]];
}

@@ -170,3 +167,3 @@ let values = value.toLowerCase().split(/[\s|,|\-|_]+/);

if (!currentIndex.children[char]) {
currentIndex.children[char] = { children: {}, emojis: {} };
currentIndex.children[char] = { children: {}, emojis: new Map() };
}

@@ -177,3 +174,3 @@ currentIndex = currentIndex.children[char];

currentIndex.results = [];
for (const emojiItem of Object.values(emojisPool)) {
for (const emojiItem of emojisPool.values()) {
const search = searchLookup.get(emojiItem.id);

@@ -188,3 +185,3 @@ const sub = value.substring(0, length);

currentIndex.results.push(emojiItem);
currentIndex.emojis[emojiItem.id] = emojiItem;
currentIndex.emojis.set(emojiItem.id, emojiItem);
scores[emojiItem.id] = score;

@@ -235,3 +232,3 @@ }

const id = emoticonsLookup.get(emoticon);
return id ? emojis[id] : undefined;
return id ? emojis.get(id) : undefined;
},

@@ -238,0 +235,0 @@ setCustom(custom) {

{
"name": "@fibery/emoji-data",
"version": "2.4.0",
"version": "2.5.0",
"description": "Emoji dataset used in Fibery",

@@ -5,0 +5,0 @@ "license": "UNLICENSED",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc