Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const outputVariables = pattern => {
if (!pattern) {
pattern = ''
}
const vars = Object.keys(config.decks.delete)
const mapper = key => ({
title: key,
subtitle: `current deck is ⇒ ${alfy.config.get('default-deck')} | ↵ choose this or pick out another`,
valid: false,
autocomplete: `!del ${key} `,
icon: {path: './icons/delete.png'}
})
const out = alfy.matches(pattern, Object.keys(config.decks.delete)).map(mapper)
return out.length === 0 ? vars.map(mapper) : out
}
if (!pattern) {
pattern = ''
}
const vars = Object.keys(config.models)
const mapper = key => ({
title: `${key} ⇒ ${
Object.keys(alfy.config.get(key))[0] === undefined ? config.models['default-model'] : Object.keys(alfy.config.get(key))[0]}`,
subtitle: '↵ pick out another model...',
valid: false,
autocomplete: `!model ${key} `,
icon: {path: './icons/Model.png'}
})
const out = alfy.matches(pattern, Object.keys(config.models)).map(mapper)
return out.length === 0 ? vars.map(mapper) : out
}
const outputVariables = pattern => {
if (!pattern) pattern = ''
const vars = Object.keys(config.reset)
const mapper = key => ({
title: key,
subtitle: pattern === '' ? 'Hit ↵ to reset all previous settings' : 'hold on...',
valid: false,
autocomplete: '!reset reseting... ',
icon: {path: './icons/Reset.png'}
})
const out = alfy.matches(pattern, Object.keys(config.reset)).map(mapper)
return out.length === 0 ? vars.map(mapper) : out
}
if (!pattern) {
pattern = ''
}
const vars = Object.keys(config.decks.defaults)
const mapper = key => ({
title: `${key} ⇒ ${
alfy.config.get(key) === undefined ? config.decks.defaults['default-deck'] : alfy.config.get(key)}`,
subtitle: '↵ pick out another ...',
valid: false,
autocomplete: `!set ${key} `,
icon: {path: './icons/settings.png'}
})
const out = alfy.matches(pattern, Object.keys(config.decks.defaults)).map(mapper)
return out.length === 0 ? vars.map(mapper) : out
}
const outputVariables = pattern => {
if (!pattern) {
pattern = ''
}
const vars = Object.keys(config.refresh)
const mapper = key => ({
title: key,
subtitle: pattern === '' ? 'Hit ↵ to toogle current theme dark / light' : 'hold on...',
valid: false,
autocomplete: '!theme toogle... ',
icon: {path: './icons/night_and_day.png'}
})
const out = alfy.matches(pattern, Object.keys(config.theme)).map(mapper)
return out.length === 0 ? vars.map(mapper) : out
}
const outputVariables = pattern => {
if (!pattern) {
pattern = ''
}
const vars = Object.keys(config.decks.refresh)
const mapper = key => ({
title: key,
subtitle: pattern === '' ? 'Hit ↵ to refresh cards in decks | It will take a few seconds' : 'hold on, your collection will be update',
valid: false,
autocomplete: '!refresh refreshing... ',
icon: {path: './icons/refresh.png'}
})
const out = alfy.matches(pattern, Object.keys(config.decks.refresh)).map(mapper)
return out.length === 0 ? vars.map(mapper) : out
}
module.exports = (pattern, autocomplete = () => undefined) => {
if (!pattern) {
pattern = ''
}
const out = alfy.matches(pattern, langNames)
.map(name => ({
title: name.slice(0, 1).toUpperCase() + name.slice(1),
autocomplete: autocomplete(name),
valid: false,
icon: {
path: `icons/${languages.getCode(name)}.png`
}
}))
return out.length === 0 ? null : out
}
if (!pattern) {
pattern = ''
}
const vars = Object.keys(config.profiles)
const mapper = key => ({
title: `${key} ⇒ ${
alfy.config.get(key) === undefined ? config.profiles['default-profile'] : alfy.config.get(key)}`,
subtitle: '↵ pick out another profile...',
valid: false,
autocomplete: `!profile ${key} `,
icon: {path: './icons/Profile.png'}
})
const out = alfy.matches(pattern, Object.keys(config.profiles)).map(mapper)
return out.length === 0 ? vars.map(mapper) : out
}
const outputVariables = pattern => {
if (!pattern) {
pattern = ''
}
const vars = Object.keys(config.delete)
const mapper = key => ({
title: key,
subtitle: `current deck is ⇒ ${alfy.config.get('default-deck')} | ↵ choose this or pick out another`,
valid: false,
autocomplete: `!del ${key} `,
icon: {path: './icons/delete.png'}
})
const out = alfy.matches(pattern, Object.keys(config.delete)).map(mapper)
return out.length === 0 ? vars.map(mapper) : out
}