'use strict'; const knex = require('./knex'); async function matchTags(rawTags) { const tagEntries = await knex('tags').whereIn('tags.tag', rawTags.map(tag => tag.toLowerCase())); return Array.from(new Set(tagEntries.map((tag => tag.alias_for || tag.tag)).sort())); // reduce to tag name and filter duplicates } module.exports = { matchTags };