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 🙏

© 2025 – Pkg Stats / Ryan Hefner

simple-query-params

v1.0.5

Published

Simple, tiny, typed and tested library to manage query params

Readme

Simple query params

CircleCI

Maintainability

Simple, tiny, typed and tested library to manage with ease query param.

It can be used to add query params to url or modify those that url contains.

Download

npm install simple-query-params

API

This library exposes two classes, Url and QueryParams.

Url

// You can build one Url instance passing a url

const url = new Url('https://www.fakeurl.com?foo=bar');

// This object exposes multiples methods and properties:

url.baseUrl  // Returns base url, for this example 'https://www.fakeurl.com?'

url.originalUrl // Returns the url which used to create instance and keep it, never changes.

url.setValue(name: string, value: QueryParamType, mode?: 'append' | 'replace'); // Sets the value to existing query param or create it if doesn't exists. `mode` is used when query param its an array, then, with 'append' you push another value at the tail of the array, with 'replace', the array is overwitted by the value passed.

url.setValue('foo', 'baz'); // Change the value of 'foo' parameter to 'baz'

url.setValue('param', 123); // Creates new param

url.builtUrl // Returns the built url with query params applied. 
// https://www.fakeurl.com?foo=faz&param=123

url.getParam(name: string); // Gets parameter, finding it by it name

Query Param

Create new instance of this object make no sense, its usefull only when its accesed through Url#getParam.

  
  const queryParam = url.getParam('name');

  // This class exposes the following get/set methods:

  queryParam.stringified // returns formated parameter. p.e: 'name=value' instead {name, value}

  queryParam.value // returns parameter value

  queryParam.name // returns parameter name

  queryParam.type // returns the undelying type of parameter. p.e: 'value' will return 'string', 123 and '123' will return 'number'. And 'v,a,l,u,e' will return 'array

  queryParam.isString // Returns true if undelying value type is string, false otherwise

  queryParam.isNumber // Returns true if undelying value type is number, false otherwise

  queryParam.isArray // Returns true if undelying value type is string, false otherwise

  // Only exposes one method

  queryParam.setValue(value: QueryParamType, mode?: 'append' | 'replace') // change de value of parameter. mode argument works like Url#setValue