@wordpress/url
Version:
WordPress URL utilities.
23 lines (20 loc) • 490 B
JavaScript
/**
* External dependencies
*/
import { URL } from 'react-native-url-polyfill';
/* eslint-disable jsdoc/valid-types */
/**
* @type {typeof import('./is-url').isURL}
*/
/* eslint-enable */
export function isURL(url) {
// A URL can be considered value if the `URL` constructor is able to parse
// it. The constructor throws an error for an invalid URL.
try {
new URL(url);
return true;
} catch (error) {
return false;
}
}
//# sourceMappingURL=is-url.native.js.map