isurl

Determines whether a value is a WHATWG URL.

MIT 12 个版本
安装
npm install isurl
yarn add isurl
pnpm add isurl
bun add isurl
README

isurl NPM Version File Size Build Status Dependency Monitor

Determines whether a value is a WHATWG URL.

Works cross-realm/iframe and despite Symbol.toStringTag.

Installation

Node.js >= 8 is required. To install, type this at the command line:

npm install isurl

Usage

const isURL = require('isurl');

isURL('http://domain/');  //-> false
isURL(new URL('http://domain/'));  //-> true

Optionally, acceptance can be extended to incomplete URL implementations that lack origin, searchParams and toJSON properties (which are common in many modern web browsers):

const url = new URL('http://domain/?query');

console.log(url.searchParams);  //-> undefined

isURL.lenient(url);  //-> true
版本列表
4.0.2 2021-02-27
4.0.1 2019-04-22
4.0.0 2019-01-07
3.0.0 2019-01-07
2.0.0 2018-11-28
1.0.0-alpha 2017-02-21
1.0.0 2017-06-29
1.0.0-alpha6 2017-06-16
1.0.0-alpha5 2017-04-18
1.0.0-alpha4 2017-04-09
1.0.0-alpha3 2017-03-26
1.0.0-alpha2 2017-02-24