rename util/util to util/misc

This commit is contained in:
zkldi
2021-05-25 19:05:55 +01:00
parent 176502e32d
commit 3e2c7f2279
8 changed files with 14 additions and 7 deletions
@@ -12,7 +12,7 @@ import { KtLogger } from "../../../utils/types";
import { ImportAllIterableData } from "./score-importing/score-importing";
import { CreateImportLoggerAndID } from "./common/import-logger";
import { CreateSessions } from "./sessions/sessions";
import { GetMilisecondsSince } from "../../../utils/util";
import { GetMilisecondsSince } from "../../../utils/misc";
import { ProcessPBs } from "./pb/process-pbs";
import { UpdateUsersGamePlaytypeStats } from "./user-game-stats/update-ugs";
import db from "../../../external/mongo/db";
@@ -4,7 +4,7 @@ import CreateLogCtx from "../../../../logger/logger";
import { GetKTDataJSON, Testing511Song, Testing511SPA } from "../../../../../test-utils/test-data";
import { ResolveChartFromSong, ResolveMatchTypeToKTData, ConverterBatchManual } from "./converter";
import deepmerge from "deepmerge";
import { EscapeStringRegexp } from "../../../../../utils/util";
import { EscapeStringRegexp } from "../../../../../utils/misc";
import db, { CloseMongoConnection } from "../../../../../external/mongo/db";
import { Game } from "kamaitachi-common";
import ResetDBState from "../../../../../test-utils/reset-db-state";
@@ -4,7 +4,7 @@ import CreateLogCtx from "../../../../logger/logger";
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
import { ParseBatchManualFromObject as ParserFn } from "./parser";
import { BatchManual } from "./types";
import { EscapeStringRegexp } from "../../../../../utils/util";
import { EscapeStringRegexp } from "../../../../../utils/misc";
import deepmerge from "deepmerge";
const mockErr = (...msg: string[]) =>
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import t from "tap";
import { GetMilisecondsSince } from "../../../../../utils/util";
import { GetMilisecondsSince } from "../../../../../utils/misc";
import { CloseMongoConnection } from "../../../../../external/mongo/db";
import CreateLogCtx from "../../../../logger/logger";
import { MockMulterFile } from "../../../../../test-utils/mock-multer";
+1 -1
View File
@@ -1,7 +1,7 @@
import { integer, PBScoreDocument, ScoreDocument, ChartDocument } from "kamaitachi-common";
import CreateLogCtx from "../../../../lib/logger/logger";
import { GetPBOnChart, GetServerRecordOnChart } from "../../../../utils/scores";
import { MStoS } from "../../../../utils/util";
import { MStoS } from "../../../../utils/misc";
import { USCIR_ADJACENT_SCORE_N } from "../../../../lib/constants/usc-ir";
import db from "../../../../external/mongo/db";
@@ -1,5 +1,5 @@
import t from "tap";
import { GetMilisecondsSince } from "./util";
import { GetMilisecondsSince } from "./misc";
t.test("#GetMilisecondsSince", (t) => {
const time = GetMilisecondsSince(10n);
@@ -30,3 +30,10 @@ export function Random20Hex() {
export function MStoS(ms: number) {
return Math.floor(ms / 1000);
}
/**
* Random From Array - Selects a random value from an array.
*/
export function RFA(arr: unknown[]) {
return arr[Math.floor(Math.random() * arr.length)];
}
+1 -1
View File
@@ -1,7 +1,7 @@
import { Game, AnySongDocument, integer } from "kamaitachi-common";
import { FindOneResult } from "monk";
import db from "../../external/mongo/db";
import { EscapeStringRegexp } from "../util";
import { EscapeStringRegexp } from "../misc";
/**
* Finds a song document for the given game with the given title (or alt-title).