Skip to content

Commit

Permalink
docs: More shortcodes debugging.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Mar 5, 2022
1 parent 35463d6 commit 271e141
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions website/src/components/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,24 @@ export function processEmojis(
}

// This randomly is a set and i'm not sure why...
if (emoji.shortcodes instanceof Set) {
// eslint-disable-next-line no-console
console.debug('SET found', emoji.hexcode, emoji);
if (emoji.shortcodes) {
const shortcodes: string[] = [];

emoji.shortcodes.forEach((code) => {
// @ts-expect-error Debugging
if (code instanceof Set || Array.isArray(code)) {
// eslint-disable-next-line no-console
console.debug('Non-string found', emoji.hexcode, emoji);

[...code].forEach((sc) => {
shortcodes.push(String(sc));
});
} else if (typeof code === 'string') {
shortcodes.push(code);
}
});

emoji.shortcodes = [...emoji.shortcodes].map(String);
emoji.shortcodes = shortcodes;
}

if (filter) {
Expand Down

0 comments on commit 271e141

Please sign in to comment.