ra-core
Version:
Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React
20 lines • 697 B
TypeScript
/**
* Return the URL if it can be used as a link href without executing code,
* or undefined otherwise (and log an error)
*
* Rejects javascript: URLs, including obfuscated ones (mixed case,
* whitespace, control characters). Relative URLs are safe.
*
* @example
* getSafeUrl('https://example.com'); // 'https://example.com'
* getSafeUrl('/posts/1'); // '/posts/1'
* getSafeUrl('javascript:alert(1)'); // undefined
*/
export declare const getSafeUrl: (url: string) => string | undefined;
/**
* Check that a URL can be used as a link href without executing code
*
* @see getSafeUrl
*/
export declare const isSafeUrl: (url: string) => boolean;
//# sourceMappingURL=getSafeUrl.d.ts.map