How to use the emoji-datasource-apple.reduce function in emoji-datasource-apple

To help you get started, we’ve selected a few emoji-datasource-apple 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 jukben / alfred-emoji / index.js View on Github external
"use strict";

const path = require("path");
const alfy = require("alfy");
const search = require("@jukben/emoji-search").default;
const unicode = require("@jukben/unicode").default;
const emojis = require("emoji-datasource-apple");

const ALWAYS_OFFLINE = +process.env["always-offline"] || 0;

const emojiLookup = emojis.reduce((a, v, i, arr) => {
  a[v.unified.toLowerCase()] = v;

  if (v.non_qualified) {
    a[v.non_qualified.toLowerCase()] = v;
  }

  return a;
}, {});

const getHex = char => unicode(char).hexCodeAt(0);

function getImagePath(char) {
  return `${path.dirname(require.resolve("emoji-datasource-apple"))}/img/apple/64/${emojiLookup[getHex(char)].image}`;
}

function getName(char) {

emoji-datasource-apple

Emoji data and images - apple

MIT
Latest version published 9 months ago

Package Health Score

66 / 100
Full package analysis

Popular emoji-datasource-apple functions