mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2026-01-27 12:50:47 +03:00
getChapterNames
- remove identifier from segmentGen - add multiGenRandomValue - add videoInfo query
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
import crypto from "crypto";
|
||||
|
||||
export const genRandom = (bytes=8) => crypto.pseudoRandomBytes(bytes).toString("hex");
|
||||
export const genRandom = (bytes=8): string => crypto.pseudoRandomBytes(bytes).toString("hex");
|
||||
|
||||
export const genRandomValue = (prefix: string, identifier: string, bytes=8) => `${prefix}-${identifier}-${genRandom(bytes)}`;
|
||||
export const genRandomValue = (prefix: string, identifier: string, bytes=8): string => `${prefix}-${identifier}-${genRandom(bytes)}`;
|
||||
export const multiGenRandomValue = (prefix: string, identifier: string, count: number, bytes=8): string[] => {
|
||||
const arr: string[] = [];
|
||||
for (let i = 0; i < count; i++) arr.push(genRandomValue(prefix, identifier, bytes));
|
||||
return arr;
|
||||
};
|
||||
Reference in New Issue
Block a user