$ npm install 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.
npm install isurl
The standard.
import isURL from 'isurl';
isURL('http://domain/'); //-> false
isURL(new URL('http://domain/')); //-> true
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
© 2010 - cnpmjs.org x YWFE | Home | YWFE