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
It would be good to have a
URL.isValidmethod?Today we have to do something like:
The proposal is to have something like: