swc/bundler/tests/.cache/deno/154c6073e975b13f958f5ec193d87807d5ce9747.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

21 lines
461 B
TypeScript

// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isLocale.ts
// @ts-ignore allowing typedoc to build
import { assertString } from '../helpers/assertString.ts';
/**
* @ignore
*/
const localeReg = /^[A-z]{2,4}([_-]([A-z]{4}|[\d]{3}))?([_-]([A-z]{2}|[\d]{3}))?$/;
export const isLocale = (str: string) => {
assertString(str);
if (str === 'en_US_POSIX' || str === 'ca_ES_VALENCIA') {
return true;
}
return localeReg.test(str);
};