swc/bundler/tests/.cache/deno/7e17928999646c49e71cacee35d6f7300f2ed537.ts

16 lines
386 B
TypeScript
Raw Normal View History

// 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());
};