Socket
Socket
Sign inDemoInstall

url-parse-lax

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc