npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bare-url

v2.4.3

Published

WHATWG URL implementation for JavaScript

Downloads

85,550,753

Readme

bare-url

WHATWG URL implementation for JavaScript, built on https://github.com/holepunchto/liburl. Provides URL and URLSearchParams classes compatible with the WHATWG URL Standard.

npm i bare-url

Usage

const { URL, URLSearchParams } = require('bare-url')

const url = new URL('https://example.com/path?foo=bar#hash')

console.log(url.hostname) // 'example.com'
console.log(url.pathname) // '/path'
console.log(url.searchParams.get('foo')) // 'bar'

To register URL and URLSearchParams as globals:

require('bare-url/global')

API

const url = new URL(input[, base])

Parse input as a URL. If base is provided, input is resolved relative to base. Throws if input is not a valid URL.

url.href

The full serialized URL string. Setting this property reparses the URL.

url.protocol

The URL scheme followed by ':', e.g. 'https:'.

url.username

The username portion of the URL, or an empty string.

url.password

The password portion of the URL, or an empty string.

url.host

The hostname and port, e.g. 'example.com:8080'.

url.hostname

The hostname without the port.

url.port

The port as a string, or an empty string if not present.

url.pathname

The path portion of the URL.

url.search

The query string including the leading '?', or an empty string.

url.searchParams

A URLSearchParams object for the query string. Mutations to the params are reflected in the URL.

url.hash

The fragment including the leading '#', or an empty string.

url.toString()

Returns the serialized URL string. Equivalent to url.href.

url.toJSON()

Returns the serialized URL string. Suitable for JSON serialization.

const params = new URLSearchParams([init])

Create a new URLSearchParams instance. init may be a query string, an iterable of [name, value] pairs, or an object of key-value pairs.

params.size

The total number of search parameters.

params.append(name, value)

Append a new name/value pair.

params.delete(name[, value])

Remove all pairs with name. If value is provided, only pairs with both the matching name and value are removed.

params.get(name)

Return the first value for name, or null if not present.

params.getAll(name)

Return all values for name as an array.

params.has(name[, value])

Return true if a pair with name exists. If value is provided, the pair must also match value.

params.set(name, value)

Set the value for name, replacing any existing pairs with that name.

params.toString()

Return the serialized query string without the leading '?'.

params.toJSON()

Return the parameters as an array of [name, value] pairs.

URL.isURL(value)

Return true if value is a URL instance.

URLSearchParams.isURLSearchParams(value)

Return true if value is a URLSearchParams instance.

const url = URL.parse(input[, base])

Parse input as a URL without throwing. Returns a URL instance on success, or null on failure.

const valid = URL.canParse(input[, base])

Return true if input can be parsed as a valid URL, optionally relative to base.

const pathname = URL.fileURLToPath(url)

Convert a file: URL to a platform-specific file path. url may be a URL instance or a string. Throws if the URL does not use the file: protocol or contains invalid path characters.

const url = URL.pathToFileURL(pathname)

Convert a platform-specific file path to a file: URL.

const href = URL.format(parts)

Format a URL from individual parts:

parts = {
  protocol,
  auth,
  host,
  hostname,
  port,
  pathname,
  search,
  query,
  hash,
  slashes
}

All properties are optional. If host is provided, hostname and port are ignored. If search is provided, query is ignored. Set slashes to true to include '//' after the protocol.

License

Apache-2.0