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
@@ -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).