How to use the emojibase.stripHexcode 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 / builders / buildAnnotationData.ts View on Github external
Object.keys(sequences).forEach(fullHexcode => {
    const hexcode = stripHexcode(fullHexcode);
    const emoji = sequences[fullHexcode];
    const tags: string[] = extractField(hexcode, 'tags') || [];
    let annotation: string = extractField(hexcode, 'annotation') || '';

    // Use the localized territory name
    if (hasProperty(emoji.property, ['Emoji_Flag_Sequence'])) {
      const countryCode = fullHexcode
        .split('-')
        .map((hex: string) => REGIONAL_INDICATORS[hex])
        .join('');

      if (!annotation) {
        annotation = localization.territories[countryCode];
      }

      tags.push(countryCode);
github milesj / emojibase / packages / generator / src / generators / generateData.ts View on Github external
if ('tone' in baseEmoji && baseEmoji.tone !== null) {
    emoji.tone = baseEmoji.tone;
  }

  // Presentation variations
  if ('variations' in baseEmoji) {
    emoji.emoji = toUnicode(baseEmoji.variations!.emoji);
    emoji.text = toUnicode(baseEmoji.variations!.text);
  }

  if ('emoticon' in baseEmoji) {
    emoji.emoticon = baseEmoji.emoticon;
  }

  // Annotations
  const annotation = annotations[stripHexcode(emoji.hexcode)]; // No ZWJ, selectors

  if (annotation) {
    if (annotation.annotation) {
      emoji.annotation = annotation.annotation;
    }

    if (annotation.tags && annotation.tags.length > 0) {
      emoji.tags = annotation.tags;

      // Sort the tags for easier diffs
      emoji.tags.sort();

      // Some locales duplicate the annotation in the tag list
      if (emoji.tags.length > 1) {
        emoji.tags = emoji.tags.filter((tag: string) => tag !== emoji.annotation);
      }
github milesj / emojibase / packages / generator / src / generators / generateData.ts View on Github external
emoji.skins = Object.values(baseEmoji.modifications!).map(mod => {
      const skin = createEmoji(mod, versions, annotations);

      skin.annotation = (annotations[stripHexcode(skin.hexcode)] || {}).annotation || '';
      skin.shortcodes = (emoji.shortcodes || []).map(
        code => `${code}_tone${Array.isArray(skin.tone) ? skin.tone.join('-') : skin.tone}`,
      );

      // Remove any tags
      delete skin.tags;

      return skin;
    });
  }
github airbnb / lunar / .storybook / bootstrap.js View on Github external
emojiCDN: (hexcode, large) =>
    `https://cdn.jsdelivr.net/emojione/assets/4.5/png/${large ? 64 : 32}/${stripHexcode(
      hexcode,
    ).toLowerCase()}.png`,
  logger: console.log,