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

16 lines
386 B
TypeScript

// Loaded from https://deno.land/x/segno@v1.1.0/lib/validations/isMagnetURI.ts
// @ts-ignore allowing typedoc to build
import { assertString } from '../helpers/assertString.ts';
/**
* @ignore
*/
const magnetURI = /^magnet:\?xt=urn:[a-z0-9]+:[a-z0-9]{32,40}&dn=.+&tr=.+$/i;
export const isMagnetURI = (url: string) => {
assertString(url);
return magnetURI.test(url.trim());
};