mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 03:07:04 +02:00
feat: accent-tolerant tank search
This commit is contained in:
1 parent
bb2450eb3c
commit
70575fa9cf
3 files changed
+26
-13
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { deburr } from 'lodash';
|
||||
import { secrets } from '../node/secrets';
|
||||
import getWargamingResponse from './getWargamingResponse';
|
||||
|
||||
@@ -36,6 +37,20 @@ export const TANKS = new Promise<TankopediaEntry[]>(async (resolve) => {
|
||||
export const TANK_NAMES = new Promise<string[]>(async (resolve) => {
|
||||
resolve((await entries).map(({ name }) => name));
|
||||
});
|
||||
export const TANK_NAMES_DIACRITICS = TANK_NAMES.then((tankNames) =>
|
||||
Promise.all(
|
||||
tankNames.map(async (tankName, index) => {
|
||||
const name = tankName ?? `Unknown Tank ${(await TANKS)[index].tank_id}`;
|
||||
const diacriticless = deburr(name);
|
||||
|
||||
return {
|
||||
original: name,
|
||||
diacriticless,
|
||||
combined: `${name}${diacriticless}`,
|
||||
};
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
export interface TankopediaInfo {
|
||||
achievement_sections: Record<string, { name: string; order: number }>;
|
||||
|
||||
Reference in new issue
Block a user