How to use the emojibase.SUPPORTED_LOCALES.map function in emojibase

To help you get started, we’ve selected a few emojibase examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github milesj / emojibase / packages / generator / src / generators / generateData.ts View on Github external
export default async function generateData(): Promise {
  log.title('data', 'Generating emoji datasets');

  const data = await buildEmojiData();
  const filteredData = filterData(data);
  const versions = createVersionMap();

  // Generate datasets for each locale
  await Promise.all(
    SUPPORTED_LOCALES.map(async (locale: string) => {
      const annotations = await buildAnnotationData(locale);
      const emojis = Object.keys(filteredData).map(hexcode =>
        createEmoji(filteredData[hexcode], versions, annotations),
      );

      // Sort by order
      emojis.sort((a, b) => (a.order || 0) - (b.order || 0));

      return Promise.all([
        writeDataset(`${locale}/raw.json`, emojis),
        writeDataset(`${locale}/data.json`, emojis, true),
        writeDataset(`${locale}/compact.json`, extractCompact(emojis), true),
      ]);
    }),
  );