mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-16 08:26:59 +03:00
11 lines
349 B
TypeScript
11 lines
349 B
TypeScript
import { config } from "../config";
|
|
|
|
const minimumPrefix = config.minimumPrefix || "3";
|
|
const maximumPrefix = config.maximumPrefix || "32"; // Half the hash.
|
|
|
|
const prefixChecker = new RegExp(`^[\\da-f]{${minimumPrefix},${maximumPrefix}}$`, "i");
|
|
|
|
export function hashPrefixTester(prefix: string): boolean {
|
|
return prefixChecker.test(prefix);
|
|
}
|