mirror of
https://github.com/swc-project/swc.git
synced 2024-12-20 20:22:26 +03:00
16 lines
386 B
TypeScript
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());
|
||
|
};
|