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

unurl

v0.10.0

Published

Simple reactive URL-like object

Downloads

28

Readme

unurl

Simple reactive URL object

Note: uses Proxy, check browser support before using.

Install

npm i unurl

Usage

const { url, onChange } = require('unurl')

onChange(() => {
  // Fires when url changes
})

function changeURL() {
  url.pathname = '/new-path'
  url.searchParams.append('foo', 'bar')
}
const { url } = require('unurl')
const { connect } = require('unurl/react')

const ReactComponentConnectStyle = connect(() => {
  // re-renders when url changes
})
const { useUrl } = require('unurl/react')

const ReactComponentEffectStyle = () => {
  const url = useUrl()
  // re-renders when url changes
}

API

const { url, searchParams, onChange, listen } = require('unurl')

url

A Proxy of new URL that fires onChange whenever a property is changed.

  • @property {string} hostname A String containing the domain of the URL.
  • @property {string} pathname A String containing an initial '/' followed by the path of the URL.
  • ...URL#Properties

searchParams

searchParams but in an object-form with values parsed for easier consumption.

Querystring | Object | Remark -------------|-------------------|---------------- ?a=b | { a: 'b' } | key=value converted to { key: value } ?a=1 | { a: 1 } | JSON parsed (~~'1'~~ 1) ?a, ?a= | { a: true } | Existence of key inferred as value true ?a=1,b | { a: [1, 'b'] } | Comma-separated parsed as array

onChange

A function to register a callback that's fired whenever url is changed, or when listening to browser events.

  • @param {function} callback Callback to fire when url changes
  • @returns {function} unRegister Frees the callback from firing anymore

listen

Listen to browser events: click (on an <a> element), popstate, and hashchange to fire onChange.

  • @param {object} [opts]
  • @param {Boolean|Object} [opts.click={}] Listen to click events on all <a> elements. Will prevent if href is from the same (current) hostname. Options will be passed to addEventListener.
  • @returns {function} removeListener Removes and frees the attached event listeners

React API

React-specific helper functions.

const { connect, useUrl } = require('unurl/react')

connect

Converts a React Component into one that re-renders whenever url changes.

  • @param {ReactComponent|Function} component React Component or a function to wrap
  • @returns {ReactComponent} component Wrapper Component that renders the above component

useUrl

A React Hook that updates whenever url changes.