Skip to content

Commit

Permalink
eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Jan 16, 2024
1 parent 2061783 commit 5d346ba
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/v2/repository/firestorm/packs.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,25 @@ export default class PackFirestormRepository implements PackRepository {
criteria: "==",
value: resolution,
});
const prom: Promise<FirestormPack[]> = options.length
const searchPromise: Promise<FirestormPack[]> = options.length
? packs.search(options)
: packs.readRaw().then(Object.values);

return prom.then(async (packs) => {
if (!type || type === "all") return packs;
const out: Packs = [];
for (const pack of packs) {
try {
await pack.submission();
} catch {
out.push(pack);
}
}
return searchPromise.then(async (searched) => {
if (!type || type === "all") return searched;
const out = (
await Promise.all(
searched.map((pack) =>
pack
.submission()
.then(() => pack)
.catch(() => undefined),
),
)
).filter((v) => v !== undefined);

if (type === "default") return out;
return packs.filter((p) => !out.includes(p));
if (type === "submission") return out;
return searched.filter((p) => !out.includes(p));
});
}

Expand Down

0 comments on commit 5d346ba

Please sign in to comment.