mirror of
https://github.com/swc-project/swc.git
synced 2024-12-30 00:52:29 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
21 lines
415 B
TypeScript
21 lines
415 B
TypeScript
// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isBase32.ts
|
|
|
|
|
|
// @ts-ignore allowing typedoc to build
|
|
import { assertString } from '../helpers/assertString.ts';
|
|
|
|
/**
|
|
* @ignore
|
|
*/
|
|
const base32 = /^[A-Z2-7]+=*$/;
|
|
|
|
export const isBase32 = (str: string) => {
|
|
assertString(str);
|
|
|
|
const len = str.length;
|
|
if (len > 0 && len % 8 === 0 && base32.test(str)) {
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|