moves random function

This commit is contained in:
Skillz
2021-02-25 15:28:49 -05:00
parent 31da4ddee6
commit f1d4f35e46
4 changed files with 5 additions and 5 deletions
+1
View File
@@ -27,4 +27,5 @@ export * from "./src/util/cache.ts";
export * from "./src/util/collection.ts"; export * from "./src/util/collection.ts";
export * from "./src/util/permissions.ts"; export * from "./src/util/permissions.ts";
export * from "./src/util/utils.ts"; export * from "./src/util/utils.ts";
export * from "./src/util/random.ts";
export * from "./src/ws/mod.ts"; export * from "./src/ws/mod.ts";
+1 -1
View File
@@ -1,4 +1,4 @@
import { chooseRandom } from "./utils.ts"; import { chooseRandom } from "./random.ts";
export class Collection<K, V> extends Map<K, V> { export class Collection<K, V> extends Map<K, V> {
maxSize?: number; maxSize?: number;
+3
View File
@@ -0,0 +1,3 @@
export function chooseRandom<T>(array: T[]) {
return array[Math.floor(Math.random() * array.length)];
}
-4
View File
@@ -27,10 +27,6 @@ export function editBotsStatus(
sendGatewayCommand("EDIT_BOTS_STATUS", { status, game: { name, type } }); sendGatewayCommand("EDIT_BOTS_STATUS", { status, game: { name, type } });
} }
export function chooseRandom<T>(array: T[]) {
return array[Math.floor(Math.random() * array.length)];
}
export async function urlToBase64(url: string) { export async function urlToBase64(url: string) {
const buffer = await fetch(url).then((res) => res.arrayBuffer()); const buffer = await fetch(url).then((res) => res.arrayBuffer());
const imageStr = encode(buffer); const imageStr = encode(buffer);