Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

url-parse-lax

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Issues
File Explorer

Advanced tools

url-parse-lax

Lax `url.parse()` with support for protocol-less URLs & IPs

    5.0.0latest

Version published
Maintainers
1
Weekly downloads
10,405,793
decreased by-13.73%

Weekly downloads

Changelog

Source

Breaking

  • Require Node.js 12.20 f20aa25
  • This package is now pure ESM. Please read this.

https://github.com/sindresorhus/url-parse-lax/compare/v4.0.0...v5.0.0

Readme

Source

url-parse-lax

Lax url.parse() with support for protocol-less URLs & IPs

Install

$ npm install url-parse-lax

Usage

import urlParseLax from 'url-parse-lax'; urlParseLax('sindresorhus.com'); /* { protocol: 'https:', slashes: true, auth: null, host: 'sindresorhus.com', port: null, hostname: 'sindresorhus.com', hash: null, search: null, query: null, pathname: '/', path: '/', href: 'https://sindresorhus.com/' } */ urlParseLax('[2001:db8::]:8000'); /* { protocol: null, slashes: true, auth: null, host: '[2001:db8::]:8000', port: '8000', hostname: '2001:db8::', hash: null, search: null, query: null, pathname: '/', path: '/', href: 'http://[2001:db8::]:8000/' } */

And with the built-in url.parse():

import url from 'url'; url.parse('sindresorhus.com'); /* { protocol: null, slashes: null, auth: null, host: null, port: null, hostname: null, hash: null, search: null, query: null, pathname: 'sindresorhus', path: 'sindresorhus', href: 'sindresorhus' } */ url.parse('[2001:db8::]:8000'); /* { protocol: null, slashes: null, auth: null, host: null, port: null, hostname: null, hash: null, search: null, query: null, pathname: '[2001:db8::]:8000', path: '[2001:db8::]:8000', href: '[2001:db8::]:8000' } */

API

urlParseLax(url, options?)

url

Type: string

The URL to parse.

options

Type: object

https

Type: boolean
Default: true

Prepend https:// instead of http:// to protocol-less URLs.

  • url-format-lax - Lax url.format() that formats a hostname and port into IPv6-compatible socket form of hostname:port

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Keywords

FAQs

What is url-parse-lax?

Lax `url.parse()` with support for protocol-less URLs & IPs

Is url-parse-lax popular?

The npm package url-parse-lax receives a total of 8,311,998 weekly downloads. As such, url-parse-lax popularity was classified as popular.

Is url-parse-lax well maintained?

We found that url-parse-lax demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 09 Aug 2021

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc