How to use twemoji - 10 common examples

To help you get started, we’ve selected a few twemoji 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 GamesDoneQuick / sgdq16-layouts / extension / twitter.js View on Github external
function addTweet(tweet) {
		// Reject tweets with media.
		if (tweet.extended_entities && tweet.extended_entities.media.length > 0) {
			return;
		}

		// Parse emoji.
		tweet.text = twemoji.parse(tweet.text);

		// Highlight the #SGDQ2016 hashtag.
		tweet.text.replace(/(#sgdq2016)/ig, '<span class="hashtag">#SGDQ2016</span>');

		// Add the tweet to the list
		tweets.value.push(tweet);
	}
github GamesDoneQuick / sgdq16-layouts / extension / twitter.js View on Github external
function addTweet(tweet) {
		// Reject tweets with media.
		if (tweet.extended_entities &amp;&amp; tweet.extended_entities.media.length &gt; 0) {
			return;
		}

		// Don't add the tweet if we already have it
		const isDupe = tweets.value.find(t =&gt; t.id_str === tweet.id_str);
		if (isDupe) {
			return;
		}

		// Parse emoji.
		tweet.text = twemoji.parse(tweet.text);

		// Highlight the #SGDQ2016 hashtag.
		tweet.text = tweet.text.replace(/#sgdq2016/ig, '<span class="hashtag">#SGDQ2016</span>');

		// Add the tweet to the list
		tweets.value.push(tweet);
	}
github GamesDoneQuick / sgdq18-layouts / dist / extension / twitter.js View on Github external
function addTweet(tweet) {
    // Don't add the tweet if we already have it
    const isDupe = tweets.value.find((t) =&gt; t.id_str === tweet.id_str) ||
        fanartTweets.value.find((t) =&gt; t.id_str === tweet.id_str);
    if (isDupe) {
        return;
    }
    // Parse emoji.
    tweet.text = twemoji.parse(tweet.extended_tweet ? tweet.extended_tweet.full_text : tweet.text);
    // Replace newlines with spaces
    tweet.text = tweet.text.replace(/\n/ig, ' ');
    // Highlight the #SGDQ2018 hashtag.
    tweet.text = tweet.text.replace(/#sgdq2018/ig, '<span class="hashtag">#SGDQ2018</span>');
    if (tweet.extended_tweet &amp;&amp;
        tweet.extended_tweet.extended_entities &amp;&amp;
        tweet.extended_tweet.extended_entities.media &amp;&amp;
        tweet.extended_tweet.extended_entities.media.length &gt; 0) {
        tweet.gdqMedia = tweet.extended_tweet.extended_entities.media;
        delete tweet.extended_tweet.extended_entities.media;
    }
    else if (tweet.extended_entities &amp;&amp;
        tweet.extended_entities.media &amp;&amp;
        tweet.extended_entities.media.length &gt; 0) {
        tweet.gdqMedia = tweet.extended_entities.media;
        delete tweet.extended_entities.media;
github euphoria-io / heim / client / lib / emoji.js View on Github external
export function lookupEmojiCharacter(icon) {
  const codePoint = twemoji.convert.toCodePoint(icon)
  if (!names[codePoint]) {
    return null
  }
  // Don't display ™ as an emoji.
  if (codePoint === '2122') {
    return null
  }
  return codePoint
}
github chibicode / Y-Combinator-for-Non-programmers / scripts / copyUsedEmojis.ts View on Github external
function grabTheRightIcon(rawText: string) {
  // if variant is present as \uFE0F
  return twemoji.convert.toCodePoint(
    rawText.indexOf(U200D) &lt; 0 ? rawText.replace(UFE0Fg, '') : rawText
  )
}
github chibicode / Y-Combinator-for-Non-programmers / scripts / copyUsedEmojis.ts View on Github external
function grabTheRightIcon(rawText: string) {
  // if variant is present as \uFE0F
  return twemoji.convert.toCodePoint(
    rawText.indexOf(U200D) &lt; 0 ? rawText.replace(UFE0Fg, '') : rawText
  )
}
github synzen / Discord.RSS / src / web / client / src / js / components / ControlPanel / utils / textParser.js View on Github external
function getEmojiURL (surrogate) {
  if (['™', '©', '®'].indexOf(surrogate) > -1) {
    return ''
  }

  try {
    // we could link to discord's cdn, but there's a lot of these
    // and i'd like to minimize the amount of data we need directly from them
    return `https://twemoji.maxcdn.com/2/svg/${Twemoji.convert.toCodePoint(surrogate)}.svg`
  } catch (error) {
    return ''
  }
}
github leovoel / embed-visualizer / src / components / markdown.jsx View on Github external
function getEmojiURL(surrogate) {
  if (['™', '©', '®'].indexOf(surrogate) > -1) {
    return '';
  }

  try {
    // we could link to discord's cdn, but there's a lot of these
    // and i'd like to minimize the amount of data we need directly from them
    return `https://twemoji.maxcdn.com/2/svg/${Twemoji.convert.toCodePoint(surrogate)}.svg`;
  } catch (error) {
    return '';
  }
}
github chibicode / Y-Combinator-for-Non-programmers / src / components / Emoji.tsx View on Github external
function grabTheRightIcon(rawText: string): string {
  // if variant is present as \uFE0F
  return twemoji.convert.toCodePoint(
    rawText.indexOf(U200D) &lt; 0 ? rawText.replace(UFE0Fg, '') : rawText
  )
}
github conversejs / converse.js / src / headless / converse-emoji.js View on Github external
async initialize () {
        /* The initialize function gets called as soon as the plugin is
         * loaded by converse.js's plugin machinery.
         */
        const { _converse } = this;
        const { ___ } = _converse;

        _converse.api.settings.update({
            'emoji_image_path': twemoji.default.base,
            'emoji_categories': {
                "smileys": ":grinning:",
                "people": ":thumbsup:",
                "activity": ":soccer:",
                "travel": ":motorcycle:",
                "objects": ":bomb:",
                "nature": ":rainbow:",
                "food": ":hotdog:",
                "symbols": ":musical_note:",
                "flags": ":flag_ac:",
                "custom": null
            },
            // We use the triple-underscore method which doesn't actually
            // translate but does signify to gettext that these strings should
            // go into the POT file. The translation then happens in the
            // template. We do this so that users can pass in their own

twemoji

A Unicode standard based way to implement emoji across all platforms.

MIT
Latest version published 2 years ago

Package Health Score

70 / 100
Full package analysis