Refactoring: split 'Utils' into multiple files; fix some stray uppercase-method names

This commit is contained in:
Pieter Vander Vennet 2025-08-01 04:02:09 +02:00
parent 81be4db044
commit 3ec89826e4
97 changed files with 884 additions and 921 deletions

View file

@ -10,6 +10,7 @@ import Script from "./Script"
import NameSuggestionIndex from "../src/Logic/Web/NameSuggestionIndex"
import TagInfo from "../src/Logic/Web/TagInfo"
import { TagsFilter } from "../src/Logic/Tags/TagsFilter"
import { Lists } from "../src/Utils/Lists"
class GenerateNsiStats extends Script {
async createOptimizationFile(includeTags = true) {
@ -139,9 +140,7 @@ class GenerateNsiStats extends Script {
)
}
const nsi = await NameSuggestionIndex.singleton()
const allBrandNames: string[] = Utils.Dedup(
nsi.allPossible(<any>type).map((item) => item.tags[type])
)
const allBrandNames: string[] = Lists.dedup(nsi.allPossible(<any>type).map((item) => item.tags[type]))
const batchSize = 50
for (let i = 0; i < allBrandNames.length; i += batchSize) {
console.warn(
@ -152,7 +151,7 @@ class GenerateNsiStats extends Script {
)
let downloaded = 0
await Promise.all(
Utils.TimesT(batchSize, async (j) => {
Utils.timesT(batchSize, async (j) => {
const brand = allBrandNames[i + j]
if (!allBrands[brand]) {
allBrands[brand] = {}