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

smart-query-string

v1.0.3

Published

A lightweight TypeScript utility for parsing and manipulating query strings — no dependencies.

Readme

Smart Query String

License: MIT npm version TypeScript

A lightweight, zero-dependency TypeScript utility for parsing and manipulating URL query strings. This package provides a simple and type-safe API for working with URL query parameters in both browser and Node.js environments.

Features

  • 🌐 First-class browser support with direct URL manipulation
  • 🔍 Parse query strings into JavaScript objects
  • 📝 Stringify objects into query strings
  • 🔄 Support for arrays and nested objects
  • 🛠️ Built-in TypeScript support
  • 🚫 Zero dependencies
  • 📦 Small bundle size

Installation

Using npm

npm install smart-query-string

Using Yarn

yarn add smart-query-string

Using pnpm

pnpm add smart-query-string

Framework Agnostic This package is designed to work seamlessly with any JavaScript framework including React, Vue, Angular, Svelte, and more. It has no framework dependencies and can be used in any JavaScript or TypeScript project.

Browser Usage

Get Current Query Parameters

import {queryString} from 'smart-query-string';

// Get all current URL query parameters as an object
const currentParams = queryString.get();
// If URL is https://example.com?page=1&sort=name
// Returns: { page: '1', sort: 'name' }

Set Query Parameters

import {queryString} from 'smart-query-string';

// Set query parameters (replaces all existing ones)
queryString.set({page: 2, sort: 'name'});
// Updates URL to: https://example.com?page=2&sort=name

Update Specific Parameters

import {queryString} from 'smart-query-string';

// Update specific parameters while preserving others
queryString.update({page: 3});
// If current URL is https://example.com?page=2&sort=name
// Updates to: https://example.com?page=3&sort=name

Remove All Query Parameters

import {queryString} from 'smart-query-string';

// Remove all query parameters from the URL
queryString.remove();
// Updates URL to: https://example.com

Remove Specific Parameters

import {queryString} from 'smart-query-string';

// Remove specific query parameters
queryString.removeKeys(['sort', 'filter']);
// If current URL is https://example.com?page=1&sort=name&filter=active
// Updates to: https://example.com?page=1

General Usage

Parsing Query Strings

import {queryString} from 'smart-query-string';

// Parse a query string
const params = queryString.parse('foo=bar&baz=qux');
// Returns: { foo: 'bar', baz: 'qux' }

// Parse URL with query string
const {url, query} = queryString.parseUrl('https://example.com?foo=bar');
// url: 'https://example.com'
// query: { foo: 'bar' }

Stringifying Objects

import {queryString} from 'smart-query-string';

// Stringify an object
const query = queryString.stringify({foo: 'bar', baz: 'qux'});
// Returns: 'foo=bar&baz=qux'

// Stringify with URL
const url = queryString.stringifyUrl({
  url: 'https://example.com',
  query: {foo: 'bar'}
});
// Returns: 'https://example.com?foo=bar'

TypeScript Support

This package is written in TypeScript and includes type definitions out of the box.

License

MIT © Mohamed Zaki