-
Notifications
You must be signed in to change notification settings - Fork 158
Closed
Labels
Description
It would be good to have a URL.isValid method?
Today we have to do something like:
const isValidUrl = (s) => {
try {
new URL(s);
return true;
} catch (err) {
return false;
}
};The proposal is to have something like:
URL.isValid(<URL>, [protocol1, protocol2]);URL.isValid('https://h3manth.com'); // true
URL.isValid('https://h3manth.com', ['file']); // false