Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const alfy = require('alfy');
const Color = require('color');
const url = 'http://m19dxw5x0q-dsn.algolia.net/1/indexes/*/queries?x-algolia-agent=Algolia%20for%20vanilla%20JavaScript%203.13.1&x-algolia-application-id=M19DXW5X0Q&x-algolia-api-key=c79b2e61519372a99fa5890db070064c';
// Determine the iconset depending on the background color
const background = new Color(alfy.alfred.themeBackground);
const iconset = background.light() ? 'black' : 'white';
alfy
.fetch(url, {
method: 'POST',
json: true,
headers: {
'Content-Type': 'application/json',
Accept: 'application/json'
},
body: `{"requests":[{"indexName":"font_awesome","params":"query=${alfy.input}&page=0&facets=%5B%5D&tagFilters=&hitsPerPage=50"}]}`
})
.then(data => {
const items = data.results[0].hits.map(x => {
return {
title: x.name,
function getColor() {
if (alfy.alfred.version) {
const color = alfy.config.get('color');
return color ? color : 'white';
}
return 'white';
}