fix: search algorithm in tagsUtils

This commit is contained in:
xHyroM 2022-07-11 08:27:10 +02:00
parent ae620b2ebb
commit f69c0b97f1

View file

@ -14,7 +14,7 @@ for (const [key, value] of Object.entries(tags)) {
} }
export const getTag = (name: string) => { export const getTag = (name: string) => {
const tag = tagCache.get(name) || tagCache.find(tag => tag.keywords.includes(name)); const tag = tagCache.get(name) || tagCache.find(tag => tag.keywords.some(k => k.includes(name)));
return tag; return tag;
} }
@ -31,8 +31,8 @@ export const findTags = (name: string) => {
if (tag) if (tag)
return [ return [
{ {
name, name: tag.keywords[0],
value: name value: tag.keywords[0],
} }
]; ];
else return findTags(null); else return findTags(null);