How to use emoji-js - 10 common examples

To help you get started, we’ve selected a few emoji-js 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 eramdam / BetterTweetDeck / tools / update_emojis.js View on Github external
const needle = require('needle');
const _ = require('lodash');
const jsEmoji = require('emoji-js');
const fs = require('fs');

const Emoji = new jsEmoji.EmojiConvertor();
Emoji.img_set = 'twitter';

function getUnified(emoji) {
  Emoji.replace_mode = 'unified';

  const converted = Emoji.replace_colons(`:${emoji.s[0]}:`);

  if (!converted.startsWith(':') && !converted.startsWith('
github raphox / slack-history / scripts / generate-session-object.js View on Github external
synonymous: HIGHLIGHT_TERMS.find((item) => item[0] === v)
          };
          return a;
        }, {});

      jsonfile.writeFileSync(destination_path, obj, { spaces: 2 });
    });
  } else {
    console.log("Error: File in 'path' not found.");
  }
}

/**
 * Convert markdown message to HTML
 */
const emojiConvertor = new emoji.EmojiConvertor();
emojiConvertor.replace_mode = 'unified';
emojiConvertor.allow_native = true;
const convertMessage = (message) => emojiConvertor.replace_colons(marked(message.trim()));

/**
 * Process the message and count the times a important word occurs
 *
 * @param {string} message
 * @param {object} highlights
 */
const highlightTerms = (message, highlights = {}) => {
  let collection = {};

  for (let synonymous of HIGHLIGHT_TERMS) {
    let count = highlights[synonymous[0]] || 0;
github RobertMenke / rm-emoji-picker / src / js / converters.js View on Github external
const getEnvironmentConverter = () : EmojiConvertor => {
    const converter = new EmojiConvertor()
    converter.init_env()
    //We don't want to use images for now - may revisit this in the future.
    if(converter.replace_mode === 'img' || converter.replace_mode === 'css'){
        return getImageConverter()
    }
    return converter
}
github keyteki / keyteki / client / Lobby.jsx View on Github external
constructor() {
        super();

        this.onChange = this.onChange.bind(this);
        this.onKeyPress = this.onKeyPress.bind(this);
        this.onSendClick = this.onSendClick.bind(this);
        this.onScroll = this.onScroll.bind(this);

        this.emoji = new EmojiConvertor();

        this.state = {
            canScroll: true,
            message: '',
            showUsers: false
        };
    }
github travis-ci / travis-web / app / helpers / format-message.js View on Github external
import { helper } from '@ember/component/helper';
import { htmlSafe } from '@ember/string';
import { get } from '@ember/object';

import EmojiConvertor from 'emoji-js';

import config from 'travis/config/environment';
import { vcsLinks } from 'travis/services/external-links';

const emojiConvertor = new EmojiConvertor();
emojiConvertor.img_sets.apple.path = `${config.emojiPrepend}/images/emoji/`;
emojiConvertor.include_title = true;
emojiConvertor.allow_native = false;

function escape(text) {
  return text
    .replace(/&/g, '&')
    .replace(//g, '>');
}

function handleMaxLength(message, maxLength) {
  if (maxLength && message.length > maxLength) {
    return `${message.slice(0, maxLength)}…`;
  } else {
    return message;
github RobertMenke / rm-emoji-picker / src / js / converters.js View on Github external
const getImageConverter = (sheets) : EmojiConvertor => {
    const converter = new EmojiConvertor()
    converter.init_env()
    converter.replace_mode = 'css'
    converter.supports_css = true
    return withSheets(converter, sheets)
}
github RobertMenke / rm-emoji-picker / src / js / Converters.js View on Github external
static get image() {
        const converter = new EmojiConvertor();
        converter.init_env();
        converter.replace_mode = 'css';
        converter.supports_css = true;
        return converter;
    }
github mattmezza / vue-beautiful-chat / src / EmojiPicker.vue View on Github external
data () {
    return {
      emojiData,
      emojiConvertor: new EmojiConvertor()
    }
  },
  props: {
github keyteki / keyteki / client / GameComponents / Messages.jsx View on Github external
'void'
        ];

        this.iconsClan = [
            'crab',
            'crane',
            'dragon',
            'lion',
            'phoenix',
            'scorpion',
            'unicorn'
        ];

        this.formatMessageText = this.formatMessageText.bind(this);

        this.emoji = new EmojiConvertor();
    }
github longseespace / ben / src / epics / app-epics.ts View on Github external
import { RootState } from '../reducers';
import { AnyAction } from 'redux';
import { Epic, ActionsObservable, StateObservable } from 'redux-observable';
import { filter, mapTo, map } from 'rxjs/operators';
import { APP_TEAMS } from '../actions';
import WindowActions from '../actions/window-actions';
import { getAllTeams } from '../reducers/selectors';
import { RTM } from '../store/rtmMiddleware/constants';
import NotificationActions from '../store/notificationMiddleware/actions';
import EmojiConvertor from 'emoji-js';
import AppTeamsActions from '../actions/app-teams-actions';

const emoji = new EmojiConvertor();
emoji.init_env();
emoji.replace_mode = 'unified';
emoji.allow_native = true;

export const pingEpic: Epic = (
  action$: ActionsObservable
) =>
  action$.pipe(
    filter((action: AnyAction) => action.type === 'PING'),
    mapTo({ type: 'PONG' })
  );

export const setWindowTitleWhenSelectTeamEpic: Epic<
  AnyAction,
  AnyAction,
  RootState

emoji-js

A JS Emoji conversion library

MIT
Latest version published 5 months ago

Package Health Score

72 / 100
Full package analysis

Popular emoji-js functions