isurl
v5.0.0
Published
Determine whether a value is a URL instance.
Readme
isurl

Determine whether a value is a
URLinstance.
Works cross-realm/iframe and despite Symbol.toStringTag.
[!NOTE]
If you need to support older versions of Node.js (going back to
8.x), use4.xof this package.
Install
npm install isurlUsage
Strict
The standard.
import isURL from 'isurl';
isURL('http://domain/'); //-> false
isURL(new URL('http://domain/')); //-> trueLenient
Acceptance can be extended to incomplete URL implementations that lack origin, searchParams and toJSON properties (which is common with web browsers from 2021):
import isURL from 'isurl/lenient';
console.log(url.searchParams); //-> undefined
isURL(url); //-> true