mirror of
https://github.com/xHyroM/bun-discord-bot.git
synced 2024-11-22 14:41:05 +01:00
fix: search algorithm in tagsUtils
This commit is contained in:
parent
ae620b2ebb
commit
f69c0b97f1
1 changed files with 3 additions and 3 deletions
|
@ -14,7 +14,7 @@ for (const [key, value] of Object.entries(tags)) {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,8 @@ export const findTags = (name: string) => {
|
|||
if (tag)
|
||||
return [
|
||||
{
|
||||
name,
|
||||
value: name
|
||||
name: tag.keywords[0],
|
||||
value: tag.keywords[0],
|
||||
}
|
||||
];
|
||||
else return findTags(null);
|
||||
|
|
Loading…
Reference in a new issue