How to use the emojis-list.map function in emojis-list

To help you get started, we’ve selected a few emojis-list 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 kldkv / convert-emojis-names / index.js View on Github external
const fs = require('fs');
const path = require('path')

const isEqual = require('lodash.isequal');
const emojiList = require('emojis-list');

const SPECIAL_SYMBOLS = [0xFE0F, 0x200D];
const args = process.argv;

const DIR_SRC = path.resolve('./', args[2]);
const DIR_DEST = path.resolve('./', args[3]);

const CUT = args[4] === 'cut';

const emojiUnicodePoints = emojiList.map((code) => [...code].map((point) => point.codePointAt(0)));
const omitSymbols = (code) => !SPECIAL_SYMBOLS.includes(code);

function main({DIR_SRC, DIR_DEST, CUT}) {  
  function convertFiles() {
    return fs.readdir(DIR_SRC, (err, files) => {
      console.time('Converted in')
      
      files.forEach(file => {
        const [name, ext] = file.split('.'); // '1f3c3-1f3ff-2642.png' -> ['1f3c3-1f3ff-2642', '.png']
        if (!name || !ext) return;

        const points = name
          .split('-') // '1f3c3-1f3ff-2642' -> ['1f3c3', '1f3ff', '2642']
          .map(code => parseInt(code, 16)) // ['1f3c3', '1f3ff', '2642'] -> [127939, 127999, 9794]
          .filter(omitSymbols); // [127939, 127999, 9794]
github Kikobeats / emojis-keywords / update.js View on Github external
'use strict'

var emojiList = require('emojis-list')
var emojiOne = require('emojione')
var log = require('acho')()
var fs = require('fs')

function stringify (val) {
  return JSON.stringify(val, null, 2)
}

var CONST = {
  MAIN_FILE: 'index.js'
}

var emojis = emojiList.map(function (emoji) {
  var emojiShortname = emojiOne.toShort(emoji)
  log.debug('detected', {emoji: emoji, shortname: emojiShortname})
  return emojiShortname
})

log.info('total:', emojis.length)
fs.writeFileSync(CONST.MAIN_FILE, 'module.exports = ' + stringify(emojis), 'utf8')
log.info('saved at', CONST.MAIN_FILE)

emojis-list

Complete list of standard emojis.

MIT
Latest version published 5 years ago

Package Health Score

67 / 100
Full package analysis