mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-01 19:38:13 +03:00
LR2Hook Converter and Parser definitions
This commit is contained in:
@@ -37,7 +37,7 @@ export function MStoS(ms: number) {
|
||||
/**
|
||||
* Random From Array - Selects a random value from an array.
|
||||
*/
|
||||
export function RFA(arr: unknown[]) {
|
||||
export function RFA<T>(arr: T[]): T {
|
||||
return arr[Math.floor(Math.random() * arr.length)];
|
||||
}
|
||||
|
||||
@@ -133,3 +133,12 @@ export function Sleep(ms: number) {
|
||||
export function GetTimeXHoursAgo(hours: integer) {
|
||||
return Date.now() - ONE_HOUR * hours;
|
||||
}
|
||||
|
||||
export function ApplyNTimes<T>(n: integer, fn: (i: integer) => T): T[] {
|
||||
const arr = [];
|
||||
for (let i = 0; i < n; i++) {
|
||||
arr.push(fn(i));
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user