Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const mapHexcode = (hexcode: string) => {
if (map[hexcode]) {
// An emoji may belong to multiple properties,
// so keep a unique list of all applicable.
map[hexcode].property = Array.from(new Set([...map[hexcode].property, ...emoji.property]));
} else {
map[hexcode] = {
...emoji,
hexcode,
};
}
};
// A sequence of emoji
if (rawHexcode.includes('..')) {
const [lowCodepoint, highCodepoint] = fromHexcodeToCodepoint(rawHexcode, '..');
for (let codepoint = lowCodepoint; codepoint <= highCodepoint; codepoint += 1) {
mapHexcode(
codepoint
.toString(16)
.padStart(4, '0')
.toUpperCase(),
);
}
// A single emoji
} else {
// v1.0 had a different structure
if (version === '1.0') {
emoji.type = property === 'emoji' ? EMOJI : TEXT;
emoji.property = [