You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

fast-querystring

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-querystring

Fast query-string parser to replace the deprecated `node:querystring` parse function.

0.2.2
Source
npmnpm
Version published
Weekly downloads
4.5M
2.88%
Maintainers
2
Weekly downloads
 
Created
Source

fast-querystring

Fast query-string parser to replace the deprecated node:querystring parse function.

Installation

npm i --save fast-querystring

Features

  • Parsed object does not have prototype methods
  • Uses & separator as default
  • Supports only input of type string
  • Supports repeating keys in query string
    • foo=bar&foo=baz parses into {foo: ['bar', 'baz']}

Differences

  • Key & value with length 0 is omitted by default
    • foo=bar&hey parses into {foo: 'bar'}, but node:querystring returns {foo: 'bar', hey: ''}

Usage

const QueryString = require('fast-querystring')
const qs = QueryString.parse('hello=world&foo=bar&values=v1&values=v2')

console.log(qs)
// {
//   hello: 'world',
//   foo: 'bar',
//   values: ['v1', 'v2']
// }

Benchmark

> fast-querystring@0.1.0 benchmark
> node test/benchmark.mjs

╔══════════════════╤═════════╤═══════════════════╤═══════════╤══════════════════════════╗
║ Slower tests     │ Samples │            Result │ Tolerance │ Difference with previous ║
╟──────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢
║ qs               │   10000 │  693377.51 op/sec │  ± 3.05 % │                          ║
║ query-string     │   10000 │  719847.15 op/sec │  ± 3.01 % │ + 3.82 %                 ║
║ node:querystring │   10000 │ 3197501.34 op/sec │  ± 1.16 % │ + 344.19 %               ║
╟──────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢
║ Fastest test     │ Samples │            Result │ Tolerance │ Difference with previous ║
╟──────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢
║ fast-querystring │   10000 │ 3500432.30 op/sec │  ± 5.57 % │ + 9.47 %                 ║
╚══════════════════╧═════════╧═══════════════════╧═══════════╧══════════════════════════╝

Keywords

querystring

FAQs

Package last updated on 05 Sep 2022

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.