swc/crates/swc_bundler/tests/.cache/deno/16c4065cd22a2681274a9b18d81f316f1f7fa9f5.ts
2021-11-09 20:42:49 +09:00

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;
};