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

url-params-query

v1.0.10

Published

A toolkit for getting URL parameters

Readme

This is a url params toolkit.

You can run npm i url-params-query to set up . All operations are not logged to history.

function query

import { query } from 'url-params-query';

If url is https://xxx/xxx?time=2020&name=abc&age=20 ,then you can use query("time") or query("name") to get time value and name value.

for example:

let time = query("time")
console.log(time) // "2020"

function setQuery

import { setQuery } from 'url-params-query';

you can use like this to add params query: setQuery(url, "time", "2020-07-07")

You can see that the URL becomes https://xxx/xxx?time=2020-07-07, if params has alread exists, it can replace value.

for example:

setQuery('localhost:3000', "time", "2020-09-09") // localhost:3000?time=2020-09-09
setQuery('localhost:3000', "time", "2020-10-01")
console.log(location.href) // http://localhost:3000?time=2020-10-01

function getQueryName

import { getQueryName } from 'url-params-query';

you can use like this to add params query: getQueryName()

If your url is https://xxx/xxx?time=2020&name=abc&age=20, it can return an array, ["time", "name", "age"]

for example:

let arr = getQueryName();
console.log(arr) // ["time", "name", "age"]

function clearQuery

import { clearQuery } from 'url-params-query';

you can use like this to delete params query:

clearQuery()

If your url is https://xxx/xxx?time=2020&name=abc&age=20, after you use this function , it can clear all params, url becomes https://xxx/xxx.

for example:

clearQuery();
console.log(location.href) // localhost:3000

If you think the tool is good, please go to https://github.com/angleneo/url-params-query and give me a star ^_^

—————————————————————————————————————————————————— 以下是中文翻译.(for Chinese translation) ——————————————————————————————————————————————————

这是一个url参数工具箱,你可以用来操作url中的参数而且不会记录在history中,通常会应用在筛选功能中,改变url但是页面不做跳转,可以很方便的回退和分享url出去。

function query

import { query } from 'url-params-query';

如果url是: https://xxx/xxx?time=2020&name=abc&age=20, 你可以使用 query("time") 或者 query("name") 来获取他们后面的值。

for example:

let time = query("time")
console.log(time) // "2020"

function setQuery

import { setQuery } from 'url-params-query';

你可以使用setQuery方法来向url添加值,如下: setQuery(url, "time", "2020-07-07")

你可以看到url变为https://xxx/xxx?time=2020-07-07, 如果参数的值再次赋值, 它可以替换当前的值。

for example:

setQuery('localhost:3000', "time", "2020-09-09") // localhost:3000?time=2020-09-09
setQuery('localhost:3000', "time", "2020-10-01")
console.log(location.href) // http://localhost:3000?time=2020-10-01

function getQueryName

import { getQueryName } from 'url-params-query';

你可以这样使用来获取当前所有参数列表 getQueryName()

它会返回一个数组, 里面包含当前的参数,["time", "name", "age"]

for example:

let arr = getQueryName();
console.log(arr) // ["time", "name", "age"]

function clearQuery

import { clearQuery } from 'url-params-query';

你可以这样使用来清除所有参数和值

clearQuery()

使用了这个方法后,会删除掉url后面的所有参数,url会变为 https://xxx/xxx

for example:

clearQuery();
console.log(location.href) // localhost:3000

如果你觉得这个工具还不错能帮得上你, 可以去 https://github.com/angleneo/url-params-query 给我一颗星好咩^-^