mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-17 13:08:49 +03:00
migrate to typescript
This commit is contained in:
committed by
Dainius Dauksevicius
parent
c462323dd5
commit
08d27265fc
10
src/utils/hashPrefixTester.ts
Normal file
10
src/utils/hashPrefixTester.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user