Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

qss

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qss

A tiny (202b) browser utility for stringifying a query Object.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
56K
decreased by-28.54%
Maintainers
1
Weekly downloads
 
Created
Source

qss Build Status

A tiny (202b) browser utility for stringifying a query Object.

You should only consider using this within a browser context since Node's built-in querystring.stringify is much faster and should be used in a Node environment! An ideal use case is serializing a query object before an API request is sent.

This module exposes three module definitions:

  • ES Module: dist/qss.mjs
  • CommonJS: dist/qss.js
  • UMD: dist/qss.min.js

Install

$ npm install --save qss

Usage

import qss from 'qss';

qss({ foo:'hello', bar:[1,2,3], baz:true });
//=> 'foo=hello&bar=1&bar=2&bar=3&baz=true'

qss({ foo:123 }, '?');
//=> '?foo=123'

qss({ bar:'world' }, 'foo=hello&');
//=> 'foo=hello&bar=world'

API

qss(params, prefix)

params

Type: Object

The object that contains all query parameter keys & their values.

prefix

Type: String
Default: ''

An optional prefix. The stringified params will be appended to this value, so it must end with your desired joiner; eg ?.

Important: No checks or validations will run on your prefix. Similarly, no character is used to "glue" the query string to your prefix string.

Benchmarks

qss
  --> 1,218,706 ops/sec ±0.24% (94 runs sampled)
native
  --> 4,271,253 ops/sec ±0.84% (93 runs sampled)
query-string
  --> 267,467 ops/sec ±0.88% (90 runs sampled)
querystringify
  --> 1,046,418 ops/sec ±0.23% (94 runs sampled)

License

MIT © Luke Edwards

Keywords

FAQs

Package last updated on 20 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc