style: run format:apply

This commit is contained in:
2026-06-19 04:29:24 -03:00
parent f51a71a574
commit c2b94bec4a
36 changed files with 3251 additions and 2597 deletions
+26 -24
View File
@@ -1,30 +1,32 @@
export const DB_BASE_URL = process.env.NODE_ENV === 'development' ? '' : 'https://dbd-db.neru.rip';
export const DB_BASE_URL =
process.env.NODE_ENV === 'development' ? '' : 'https://dbd-db.neru.rip';
const _cache = new Map<string, Promise<any>>();
export function fetchDB<T = any>(path: string): Promise<T> {
if (!_cache.has(path)) {
_cache.set(
path,
fetch(`${DB_BASE_URL}${path}`)
.then(r => {
if (!r.ok) throw new Error(`[db] ${r.status} ${path}`);
return r.json();
})
.catch(err => {
_cache.delete(path);
console.error(err);
return [];
})
);
}
return _cache.get(path)!;
if (!_cache.has(path)) {
_cache.set(
path,
fetch(`${DB_BASE_URL}${path}`)
.then((r) => {
if (!r.ok) throw new Error(`[db] ${r.status} ${path}`);
return r.json();
})
.catch((err) => {
_cache.delete(path);
console.error(err);
return [];
})
);
}
return _cache.get(path)!;
}
export const fetchCharacters = () => fetchDB('/data/characters.json');
export const fetchCustomizations = () => fetchDB('/data/customization_items.json');
export const fetchItems = () => fetchDB('/data/items.json');
export const fetchOfferings = () => fetchDB('/data/offerings.json');
export const fetchDLCs = () => fetchDB('/data/dlcs.json');
export const fetchAddons = () => fetchDB('/data/addons.json');
export const fetchPerks = () => fetchDB('/data/perks.json');
export const fetchCharacters = () => fetchDB('/data/characters.json');
export const fetchCustomizations = () =>
fetchDB('/data/customization_items.json');
export const fetchItems = () => fetchDB('/data/items.json');
export const fetchOfferings = () => fetchDB('/data/offerings.json');
export const fetchDLCs = () => fetchDB('/data/dlcs.json');
export const fetchAddons = () => fetchDB('/data/addons.json');
export const fetchPerks = () => fetchDB('/data/perks.json');
+3 -2
View File
@@ -18,10 +18,11 @@ export const cleanFolderName = (name: string): string =>
export const isKiller = (idx: number): boolean => idx >= 268435456;
export const isNamedDLC = (dlc: DLC): dlc is DLC & { name: string } => !!dlc.name && !dlc.name.startsWith('@');
export const isNamedDLC = (dlc: DLC): dlc is DLC & { name: string } =>
!!dlc.name && !dlc.name.startsWith('@');
export const randInRange = (min: number, max: number) => {
const lo = Math.min(min, max);
const hi = Math.max(min, max);
return Math.floor(Math.random() * (hi - lo + 1)) + lo;
};
};