Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* global localStorage, fetch */
var emojilib = JSON.parse(localStorage.getItem('emojilib')) || require('emojilib').lib
var emojikeys = JSON.parse(localStorage.getItem('emojikeys')) || require('emojilib').ordered
var modifiers = require('emojilib').fitzpatrick_scale_modifiers
var clipboard = require('electron').clipboard
var ipc = require('electron').ipcRenderer
var CommandProcessor = require('./CommandProcessor')
var MicAudioProcessor = require('./micAudioProcessor')
var KeywordSpotter = require('honkling-node')
var displayManager = require('./displayManager')
var index = buildIndex()
var indexKeys = Object.keys(index)
var emojikeyIndexTable = buildEmojikeyIndexTable()
var searching = false
var searchInput = document.querySelector('.js-search')
var preference = JSON.parse(localStorage.getItem('preference'))
var directions = {
sendState.message = sendState.message.split(' ').map(piece => {
if (piece.charAt(0) !== ':' || piece.charAt(piece.length - 1) !== ':') return piece;
const emoji = emojilib.ordered[emojilib.ordered.indexOf(piece.replace(/:/g, ''))];
if (!emoji || !emojilib.lib[emoji]) return piece;
return emojilib.lib[emoji].char;
}).join(' ');
}
return message.split(' ').map(function(piece) {
if (piece.charAt(0) !== ':' || piece.charAt(piece.length - 1) !== ':') return piece;
var emoji = emojilib.ordered[emojilib.ordered.indexOf(piece.replace(/:/g, ''))];
if (!emoji || !emojilib.lib[emoji]) return piece;
if (!store.bttvEmotes[piece] || store.bttvEmotes[piece].type !== 'emoji') return piece;
return emojilib.lib[emoji].char;
}).join(' ');
};
return message.split(' ').map(function(piece) {
if (piece.charAt(0) !== ':' || piece.charAt(piece.length - 1) !== ':') return piece;
var emoji = emojilib.ordered[emojilib.ordered.indexOf(piece.replace(/:/g, ''))];
if (!emoji || !emojilib.lib[emoji]) return piece;
if (!store.bttvEmotes[piece] || store.bttvEmotes[piece].type !== 'emoji') return piece;
return emojilib.lib[emoji].char;
}).join(' ');
};
'use strict'
const emojilib = require('emojilib')
const emojiNames = emojilib.ordered
let verb = 'Copy'
let preposition = 'to clipboard'
const resetWordsForPasteByDefault = () => {
verb = 'Paste'
preposition = 'as snippet'
}
const alfredItem = (emoji, name) => {
return {
uid: name,
title: name,
subtitle: `${verb} "${emoji}" (${name}) ${preposition}`,
arg: emoji,
autocomplete: name,
function isEmojiName(input) {
if (emojilib.ordered.indexOf(input) < 0) {
return false
} else {
return true
}
}
tenBitChunks.map(emojiIndex => {
const emojiName = emojilib.ordered[emojiIndex]
emojiNames.push(emojiName)
})
emojiNames.forEach(emojiName => {
if (!isEmojiName(emojiName)) {
throw new TypeError('Input contains invalid emoji name')
}
const emojiIndex = emojilib.ordered.indexOf(emojiName)
if (emojiIndex > 1023) {
throw new TypeError('Input contains characters outside the first 1024 emojis')
} else {
emojiIndices.push(emojiIndex)
}
})