isurl
Advanced tools
Comparing version 4.0.1 to 4.0.2
"use strict"; | ||
var hasToStringTag = require("has-to-string-tag-x"); | ||
var _require = require("has-to-string-tag-x"), | ||
hasToStringTag = _require["default"]; | ||
@@ -9,9 +10,9 @@ var isObject = require("is-object"); | ||
var _require = require("./props"), | ||
lenientProperties = _require.lenientProperties, | ||
strictProperties = _require.strictProperties; | ||
var _require2 = require("./props"), | ||
LENIENT_PROPERTIES = _require2.LENIENT_PROPERTIES, | ||
STRICT_PROPERTIES = _require2.STRICT_PROPERTIES; | ||
var searchParams = "searchParams"; | ||
var SEARCH_PARAMS = "searchParams"; | ||
var URL_CLASS = "[object URL]"; | ||
var toStringTag = Object.prototype.toString; | ||
var urlClass = "[object URL]"; | ||
@@ -23,14 +24,14 @@ var isURL = function isURL(url) { | ||
return false; | ||
} else if (hasToStringTag && toStringTag.call(url) !== urlClass) { | ||
} else if (hasToStringTag && toStringTag.call(url) !== URL_CLASS) { | ||
// Shimmed implementation with incorrect constructor name | ||
return false; | ||
} else if (!strictProperties.every(function (prop) { | ||
} else if (!STRICT_PROPERTIES.every(function (prop) { | ||
return prop in url; | ||
})) { | ||
return false; | ||
} else if (supportIncomplete && searchParams in url) { | ||
} else if (supportIncomplete && SEARCH_PARAMS in url) { | ||
return isURLSearchParams.lenient(url.searchParams); | ||
} else if (supportIncomplete) { | ||
return true; | ||
} else if (lenientProperties.every(function (prop) { | ||
} else if (LENIENT_PROPERTIES.every(function (prop) { | ||
return prop in url; | ||
@@ -48,3 +49,3 @@ })) { | ||
module.exports = isURL; | ||
module.exports = Object.freeze(isURL); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
var lenientProperties = ["origin", "searchParams", "toJSON"]; | ||
var strictProperties = ["hash", "host", "hostname", "href", "password", "pathname", "port", "protocol", "search", // "toString" excluded because Object::toString exists | ||
var LENIENT_PROPERTIES = ["origin", "searchParams", "toJSON"]; | ||
var STRICT_PROPERTIES = ["hash", "host", "hostname", "href", "password", "pathname", "port", "protocol", "search", // "toString" excluded because Object::toString exists | ||
"username"]; | ||
module.exports = { | ||
lenientProperties: lenientProperties, | ||
strictProperties: strictProperties | ||
LENIENT_PROPERTIES: LENIENT_PROPERTIES, | ||
STRICT_PROPERTIES: STRICT_PROPERTIES | ||
}; | ||
//# sourceMappingURL=props.js.map |
"use strict"; | ||
const hasToStringTag = require("has-to-string-tag-x"); | ||
const {default:hasToStringTag} = require("has-to-string-tag-x"); | ||
const isObject = require("is-object"); | ||
const isURLSearchParams = require("is-urlsearchparams"); | ||
const {lenientProperties, strictProperties} = require("./props"); | ||
const {LENIENT_PROPERTIES, STRICT_PROPERTIES} = require("./props"); | ||
const searchParams = "searchParams"; | ||
const SEARCH_PARAMS = "searchParams"; | ||
const URL_CLASS = "[object URL]"; | ||
const toStringTag = Object.prototype.toString; | ||
const urlClass = "[object URL]"; | ||
@@ -19,3 +20,3 @@ | ||
} | ||
else if (hasToStringTag && toStringTag.call(url)!==urlClass) | ||
else if (hasToStringTag && toStringTag.call(url)!==URL_CLASS) | ||
{ | ||
@@ -25,7 +26,7 @@ // Shimmed implementation with incorrect constructor name | ||
} | ||
else if (!strictProperties.every(prop => prop in url)) | ||
else if (!STRICT_PROPERTIES.every(prop => prop in url)) | ||
{ | ||
return false; | ||
} | ||
else if (supportIncomplete && searchParams in url) | ||
else if (supportIncomplete && SEARCH_PARAMS in url) | ||
{ | ||
@@ -38,3 +39,3 @@ return isURLSearchParams.lenient(url.searchParams); | ||
} | ||
else if (lenientProperties.every(prop => prop in url)) | ||
else if (LENIENT_PROPERTIES.every(prop => prop in url)) | ||
{ | ||
@@ -55,2 +56,2 @@ return isURLSearchParams(url.searchParams); | ||
module.exports = isURL; | ||
module.exports = Object.freeze(isURL); |
"use strict"; | ||
const lenientProperties = | ||
const LENIENT_PROPERTIES = | ||
[ | ||
@@ -10,3 +10,3 @@ "origin", | ||
const strictProperties = | ||
const STRICT_PROPERTIES = | ||
[ | ||
@@ -28,2 +28,2 @@ "hash", | ||
module.exports = { lenientProperties, strictProperties }; | ||
module.exports = { LENIENT_PROPERTIES, STRICT_PROPERTIES }; |
{ | ||
"name": "isurl", | ||
"description": "Determines whether a value is a WHATWG URL.", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"license": "MIT", | ||
@@ -11,5 +11,5 @@ "author": "Steven Vachon <contact@svachon.com> (https://svachon.com)", | ||
"dependencies": { | ||
"has-to-string-tag-x": "^1.4.1", | ||
"is-object": "^1.0.1", | ||
"is-urlsearchparams": "^1.0.1" | ||
"has-to-string-tag-x": "^2.1.2", | ||
"is-object": "^1.0.2", | ||
"is-urlsearchparams": "^1.0.2" | ||
}, | ||
@@ -37,6 +37,6 @@ "devDependencies": { | ||
"scripts": { | ||
"ci": "npm run test && nyc report --reporter=text-lcov | coveralls", | ||
"posttest": "nyc report --reporter=html && browserify lib --global-transform [ babelify --presets [ @babel/env ] ] --standalone=isURL | terser --compress --mangle | gzip-size", | ||
"ci": "npm test && nyc report --reporter=text-lcov | coveralls", | ||
"posttest": "nyc report --reporter=text-summary --reporter=html && browserify lib --global-transform [ babelify --presets [ @babel/env ] ] --standalone=isURL | terser --compress --mangle | gzip-size", | ||
"prepublishOnly": "npm test && babel lib/ --out-dir=lib-es5/ --presets=@babel/env --source-maps", | ||
"test": "nyc --reporter=text-summary mocha test.js --check-leaks --bail" | ||
"test": "nyc --silent mocha test.js --bail --check-leaks" | ||
}, | ||
@@ -43,0 +43,0 @@ "files": [ |
# isurl [![NPM Version][npm-image]][npm-url] ![File Size][filesize-image] [![Build Status][travis-image]][travis-url] [![Dependency Monitor][greenkeeper-image]][greenkeeper-url] | ||
> Determines whether a value is a WHATWG [`URL`](https://developer.mozilla.org/en/docs/Web/API/URL). | ||
> Determines whether a value is a WHATWG [`URL`](https://mdn.io/URL). | ||
@@ -11,3 +11,3 @@ | ||
[Node.js](http://nodejs.org/) `>= 8` is required. To install, type this at the command line: | ||
[Node.js](https://nodejs.org) `>= 8` is required. To install, type this at the command line: | ||
```shell | ||
@@ -39,3 +39,3 @@ npm install isurl | ||
[npm-url]: https://npmjs.com/package/isurl | ||
[filesize-image]: https://img.shields.io/badge/size-1kB%20gzipped-blue.svg | ||
[filesize-image]: https://img.shields.io/badge/bundle-3.1kB%20gzipped-blue.svg | ||
[travis-image]: https://img.shields.io/travis/stevenvachon/isurl.svg | ||
@@ -42,0 +42,0 @@ [travis-url]: https://travis-ci.org/stevenvachon/isurl |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
10659
110
- Removedhas-symbol-support-x@1.4.2(transitive)
- Removedhas-to-string-tag-x@1.4.1(transitive)
Updatedhas-to-string-tag-x@^2.1.2
Updatedis-object@^1.0.2
Updatedis-urlsearchparams@^1.0.2