url-parse-lax
Advanced tools
Comparing version 4.0.0 to 5.0.0
17
index.js
@@ -1,12 +0,11 @@ | ||
'use strict'; | ||
const url = require('url'); | ||
const prependHttp = require('prepend-http'); | ||
import {parse as parseUrl} from 'node:url'; | ||
import prependHttp from 'prepend-http'; | ||
module.exports = (inputUrl, options) => { | ||
if (typeof inputUrl !== 'string') { | ||
throw new TypeError(`Expected \`url\` to be of type \`string\`, got \`${typeof inputUrl}\` instead.`); | ||
export default function urlParseLax(url, options) { | ||
if (typeof url !== 'string') { | ||
throw new TypeError(`Expected \`url\` to be of type \`string\`, got \`${typeof url}\` instead.`); | ||
} | ||
const finalUrl = prependHttp(inputUrl, options); | ||
return url.parse(finalUrl); // eslint-disable-line node/no-deprecated-api | ||
}; | ||
const finalUrl = prependHttp(url, options); | ||
return parseUrl(finalUrl); | ||
} |
{ | ||
"name": "url-parse-lax", | ||
"version": "4.0.0", | ||
"description": "Lax url.parse() with support for protocol-less URLs & IPs", | ||
"version": "5.0.0", | ||
"description": "Lax `url.parse()` with support for protocol-less URLs & IPs", | ||
"license": "MIT", | ||
"repository": "sindresorhus/url-parse-lax", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=8" | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
@@ -23,3 +26,2 @@ "scripts": { | ||
"url", | ||
"uri", | ||
"parse", | ||
@@ -37,8 +39,8 @@ "parser", | ||
"dependencies": { | ||
"prepend-http": "^3.0.1" | ||
"prepend-http": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^2.1.0", | ||
"xo": "^0.24.0" | ||
"ava": "^3.15.0", | ||
"xo": "^0.44.0" | ||
} | ||
} |
@@ -1,6 +0,5 @@ | ||
# url-parse-lax [![Build Status](https://travis-ci.org/sindresorhus/url-parse-lax.svg?branch=master)](https://travis-ci.org/sindresorhus/url-parse-lax) | ||
# url-parse-lax | ||
> Lax [`url.parse()`](https://nodejs.org/docs/latest/api/url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost) with support for protocol-less URLs & IPs | ||
## Install | ||
@@ -12,7 +11,6 @@ | ||
## Usage | ||
```js | ||
const urlParseLax = require('url-parse-lax'); | ||
import urlParseLax from 'url-parse-lax'; | ||
@@ -59,3 +57,3 @@ urlParseLax('sindresorhus.com'); | ||
```js | ||
const url = require('url'); | ||
import url from 'url'; | ||
@@ -99,3 +97,2 @@ url.parse('sindresorhus.com'); | ||
## API | ||
@@ -109,3 +106,3 @@ | ||
URL to parse. | ||
The URL to parse. | ||
@@ -118,3 +115,3 @@ #### options | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `true` | ||
@@ -124,3 +121,2 @@ | ||
## Related | ||
@@ -130,3 +126,2 @@ | ||
--- | ||
@@ -133,0 +128,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Yes
4524
9
131
+ Addedprepend-http@4.0.0(transitive)
- Removedprepend-http@3.0.1(transitive)
Updatedprepend-http@^4.0.0