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

qsm

v2.1.2

Published

a simple tool that allows you to remove any querystring from the url

Readme

Query String Manager Build Status

A simple tool that allows you to add and remove any querystring from the url

Install

npm install --save qsm

Usage

var qsm = require('qsm');

Add

Appends querystring to the url.

var url = 'http://mywebsite.com';
var newUrl = qsm.add(url, { userId: 1337 });

// newUrl outputs: http://mywebsite.com?userId=1337

Remove

Removes any querystring by key

var url = 'http://mywebsite.com?userId=1337&sort=type';
var newurl = qsm.remove(url, 'userId');

// newurl outputs: http://mywebsite.com?sort=type

Clear

Clears all querystrings from the url

var url = 'http://mywebsite.com?userId=1337&sort=type';
var newurl = qsm.clear(url);

// newurl outputs: http://mywebsite.com

Replace

Replaces current querystrings with new ones.

var url = 'http://mywebsite.com?userId=1337&sort=type';
var newurl = qsm.replace(url, { hasObject: true });

// newurl outputs: http://mywebsite.com?hasObject=true

Exist

Checks if the current url has the querystring. returns boolean

var exists = qsm.exist('http://mywebsite.com?userId=1337&sort=type', 'userId');

// exists returns true

Get

Gets the value by key from the url returns either string or null

var userIds = qsm.get('http://mywebsite.com?userId=1336,1337,1338&sort=type', 'userId');

// userIds returns: "1336,1337,1338"
// or if it doesnt exist: null

Objectify

Transforms the querystring to a javascript object returns object

var queryObject = qsm.objectify('http://mywebsite.com?userId=1336,1337,1338&sort=type&active=true');

// queryObject returns: 
// {
//  userId: [1336,1337,1339],
//  sort: "type",
//  active: true
// }

Encode

Encodes an object or string to base64-string and appends it to the url as Q parameter.
this uses qsm.add() method in the background, so it appends it to the Q parameter.

var obj = {a: 'QSM', version: 1.2};
var url = qsm.encode('www.myurl.com', obj);
// url === 'www.myurl.com?q=e2E6ICdRU00nLCB2ZXJzaW9uOiAxLjJ9'

Encode with specific parameter

var obj = {a: 'QSM', version: 1.2};
var url = qsm.encode('www.myurl.com', obj, 'appVersion');
// url === 'www.myurl.com?appVersion=e2E6ICdRU00nLCB2ZXJzaW9uOiAxLjJ9'

Decode

Decodes an query string from the inputted URL, returns either string or object. Decodes by default the Q parameter

var url = 'www.myurl.com?q=e2E6ICdRU00nLCB2ZXJzaW9uOiAxLjJ9';
var ret = qsm.decode(url);
// ret === {a: 'QSM', version: 1.2};

Decode with specific parameter

var url = 'www.myurl.com?appVersion=e2E6ICdRU00nLCB2ZXJzaW9uOiAxLjJ9';
var ret = qsm.decode(url, 'appVersion');
// ret === {a: 'QSM', version: 1.2};

Changelog

All notable changes on this project will be documented in this file.

2.0.0 - 2017-11-17

Added

  • Gave add function a sort() on object keys so it always returns the same URL even if the keys are shuffled, this is a must have for SEO:ers, before you had to manage the object passed in to add by youself, now qsm handles this for you.
  • Fixed so that add updates values for keys that already exists instead of appending them, there was issues when you could get multiple occurrences of the same key in your url.
  • Added a warning for users using the soon to be deprecated technique with arrays instead of pure objects. Arrays will be deprecated in next major release.

1.3.0 - 2017-04-28

Changed

  • Changed how encode and decode works, they now both support of specifiying key that should get the encoded result or what key to decode. Instead of always using the q key for this.