blob: 09a6404076ad628daeb7338bb44374f63e0e9e47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
// Base64URL, with optional padding
const base64urlRegEx = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}=?))?$/;
/**
* Check to see if a string only contains valid Base64URL values
*/
export default function isBase64URLString(value: string): boolean {
if (!value) {
return false;
}
return base64urlRegEx.test(value);
}
|