How to use the emojify function from node-emoji

Find comprehensive JavaScript node-emoji.emojify code examples handpicked from public code repositorys.

29
30
31
32
33
34
35
36
37
38
  _write(msg){
    this.log(this._format(msg))
  }

  _format(msg){
    return emoji.emojify(msg)
  }
}

/**
fork icon256
star icon1
watch icon1

150
151
152
153
154
155
156
157
158
159
const getDescription = function() {
  if (! _.isUndefined(node.description)) {
    return node.description;
  }
  if (node.github_data && node.github_data.description) {
    return emojify(node.github_data.description);
  }
  if (node.crunchbase_data && node.crunchbase_data.description) {
    return node.crunchbase_data.description;
  }
fork icon119
star icon219
watch icon20

9
10
11
12
13
14
15
16
17
Handlebars.registerHelper('bool', helper.boolToEnabled);

function compile(key, data) {
        let template = Handlebars.compile(strings.get(key), { noEscape: true });
        let compiled = template(data);
        return emoji.emojify(compiled);
}

module.exports = compile;
fork icon2
star icon18
watch icon3

58
59
60
61
62
63
64
65
66
67
```js
var format = function (code, name) {
  return '<img alt="' + code + '" src="' + name + '.png" />';
});

var emojified = emoji.emojify('I :unknown_emoji: :star: :another_one:', null, format);
// emojified: I <img alt="❤️" src="heart.png" /> <img alt="☕️" src="coffee.png" />
```

## Adding new emoji
fork icon243
star icon0
watch icon12

+ 7 other calls in file

510
511
512
513
514
515
516
517
518
519
520
        emoji.emojify(':rocket:') +
          ' Cucumber HTML report ' +
          chalk.blue.bold(options.output) +
          ' generated successfully '
      ) +
      emoji.emojify(':thumbsup:')
  );
};


function generate(options, callback) {
fork icon142
star icon216
watch icon0

+ 3 other calls in file

18
19
20
21
22
23
24
25
26
27

const handleInputChange = (e) => {
  if (e.target.value === '\n') {
    return
  }
  const result = emojifier.emojify(e.target.value)
  setInput(result)
}

const checkEnter = (e) => {
fork icon25
star icon177
watch icon6

96
97
98
99
100
101
102
103
104
105
});


// Defaut (fallback) command just translates the submitted text
controller.hears('', 'direct_message,direct_mention', function (bot, message) {
    bot.reply(message, emoji.emojify(message.text));
});


// Welcome message 
fork icon47
star icon2
watch icon2

72
73
74
75
76
77
78
79
80
spinner.start();
// Phaser definitions
files.downloadFiles(`./${newFolder}/def/phaser.d.ts`, repository.phaserdef);
// Download Phaser
files.downloadFiles(`./${newFolder}/vendor/phaser/phaser.min.js`, repository.phaser);
spinner.succeed(emoji.emojify(':heart:') + ' Phaser download has finished ' + emoji.emojify(':heart:'));

spinner.text = 'Installing dependencies please be patient...';
spinner.start();
fork icon1
star icon15
watch icon2

16
17
18
19
20
21
22
23
24
25
26
var config = require('./config/default.json');
var datadir = process.env.IDENTIFI_DATADIR || (osHomedir() + '/.identifi');


function emojify(str) {
  if (process.platform === 'darwin') {
    str = emoji.emojify(str);
  } else {
    str = str.replace(/:thumbsup:/g, '+'.green)
    .replace(/:thumbsdown:/g, '-'.red)
    .replace(/:question:/g, '?'.yellow)
fork icon3
star icon2
watch icon0

43
44
45
46
47
48
49
50
51
.then((response) => {
  const data = response.body.items.map((repository) => ({
    id: repository.full_name,
    title: repository.full_name,
    value: repository.html_url,
    subtitle: emoji.emojify(repository.description)
  }))

  cache.set(cacheKey, data, { maxAge: CACHE_CONF.maxAge })
fork icon2
star icon0
watch icon2

152
153
154
155
156
157
158
159
160
161
  li.className = "red-white";
  fromServer = fromServer.replace(userId, "Me");
}

const includeEmoji = hasEmoji(emoji.emojify(fromServer));
afterEmoji = includeEmoji ? emoji.emojify(fromServer) : fromServer;

const p = document.createElement("p");
p.append(afterEmoji);
li.append(p);
fork icon1
star icon0
watch icon0

0
1
2
3
4
5
6
7
8
9
10
11
const { createLogger, format, transports } = require('winston');
const { timestamp, combine } = format;
const emoji = require('node-emoji');


const logFormat = format.printf(({level, message, timestamp, stack}) => {
    return `[${timestamp}] ${level} ${stack || emoji.emojify(message)}`;
});


const logger = createLogger({
    format: combine(
fork icon0
star icon0
watch icon0

+ 2 other calls in file

64
65
66
67
68
69
70
71
72
73
template(message, buttons)
  .then(([message, buttons]) => {
    sendPayload({
      type: 'inline-buttons',
      name,
      content: message != null ? emoji.emojify(message) : null,
      chatId,
      messageId,
      buttons,
      trackNodeId: node.trackMessage ? node._path : undefined
fork icon0
star icon0
watch icon0

57
58
59
60
61
62
63
64
65
66
// template then send
template(message)
  .then(function(translated) {
    sendPayload({
      type: _.isEmpty(buttons) ? 'telegram-reset-buttons': 'telegram-buttons',
      content: message != null ? emoji.emojify(translated) : null,
      chatId: chatId,
      messageId: messageId,
      buttons: buttons,
      isPersistent,
fork icon0
star icon0
watch icon0

37
38
39
40
41
42
43
44
45
46
        type: 'request',
        requestType: requestType,
        label: buttonLabel,
        chatId: chatId,
        messageId: messageId,
        content: emoji.emojify(translated)
      };
      node.send(msg);
    });
});
fork icon0
star icon0
watch icon0

80
81
82
83
84
85
86
87
88
89
  return;
}
// payload
sendPayload({
  type: 'message',
  content: emoji.emojify(parsedMessage),
  chatId: chatId,
  messageId: messageId,
  inbound: false,
  fallback: fallback
fork icon0
star icon0
watch icon0

58
59
60
61
62
63
64
65
66
67
.then(([translatedMessage, translatedButtons]) => {
  send({
    ...msg,
    payload: {
      type: 'quick-replies',
      content: message != null ? emoji.emojify(translatedMessage) : null,
      chatId: chatId,
      messageId: messageId,
      buttons: translatedButtons,
      trackNodeId: node.trackMessage ? node._path : undefined
fork icon0
star icon0
watch icon0

26
27
28
29
30
31
32
33
34
35
36
 */
let substituteVariables = (participant, text, sensitiveDataAlso) => {
    let newText = text;
    let varReplaceObj = ConfigParser.replaceVariablesInString(participant, text, sensitiveDataAlso);
    if(varReplaceObj.returnCode === DevConfig.SUCCESS_CODE) newText = varReplaceObj.data;
    newText = emoji.emojify(newText);
    return newText;
}


/**
fork icon0
star icon0
watch icon0

+ 2 other calls in file

0
1
2
3
4
5
6
7
8
9
10
const colores = require('cli-color');
const emoji = require('node-emoji');
const { SerialPort } = require('serialport');


// https://raw.githubusercontent.com/omnidan/node-emoji/master/lib/emoji.json
const hpQueEmocion = emoji.emojify(':star-struck:');
const hpQueGonorrea = emoji.emojify(':face_with_symbols_on_mouth:');
const nilaFeliz = emoji.emojify(':heart_eyes_cat:');
const fiesta = emoji.emojify(':dancers:');

fork icon0
star icon0
watch icon0

+ 7 other calls in file

493
494
495
496
497
498
499
500
501
502
if (message.length == 0) {
    console.info('Tried to send a message with no content.');
    return Error('No content');
}
bu.messageStats++;
message = emojify(message);

if (message.length > 2000) {
    message = 'Oops! I tried to send a message that was too long. If you think this is a bug, please report it!';
}
fork icon0
star icon0
watch icon0