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 - npm Package Compare versions

Comparing version

to
0.2.3

17

lib/parse.js

@@ -28,7 +28,16 @@ "use strict";

if (c === 38 || isNaN(c)) {
// Disallow empty key values.
if (equalityIndex - separatorIndex > 0 && i - equalityIndex + 1 > 0) {
key = input.slice(separatorIndex, equalityIndex);
value = input.slice(equalityIndex + 1, i);
const hasOnlyKey = equalityIndex <= separatorIndex;
const keySize =
hasOnlyKey ? i - separatorIndex : equalityIndex - separatorIndex;
if (keySize > 0) {
// Accept empty values, if key size is positive
if (hasOnlyKey) {
key = input.slice(separatorIndex, i);
value = "";
} else {
key = input.slice(separatorIndex, equalityIndex);
value = input.slice(equalityIndex + 1, i);
}
// Optimization: Replace '+' with space

@@ -35,0 +44,0 @@ if (hasPlus) {

{
"name": "fast-querystring",
"version": "0.2.2",
"version": "0.2.3",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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

@@ -18,7 +18,5 @@ ### Installation

- `foo=bar&foo=baz` parses into `{foo: ['bar', 'baz']}`
- Supports pairs with missing values
- `foo=bar&hola` parses into `{foo: 'bar', hola: ''}`
### 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

@@ -25,0 +23,0 @@

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.