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

isomorphic-querystring

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isomorphic-querystring - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

74

browser.js

@@ -39,53 +39,57 @@ function stringify(

const length = str.length;
if (length === 0) return result;
let key = "";
let keyOrValue = 0;
let parsedKeys = 0;
let state = 0;
let value = "";
if (str.length === 0) return result;
for (let i = 0; i <= length; i++) {
const char = str[i];
for (let i = 0; i <= length; i++) {
if (parsedKeys >= maxKeys) {
break;
if (char === undefined) {
state = 2;
}
const char = str[i];
switch (char) {
case eq:
if (!(decodeURIComponent(key) in result)) {
result[decodeURIComponent(key)] = undefined;
}
parsedKeys += 1;
keyOrValue = 1;
break;
case undefined:
case sep:
if (Array.isArray(result[decodeURIComponent(key)])) {
// concat array
result[decodeURIComponent(key)].concat(decodeURIComponent(value));
} else if (result[decodeURIComponent(key)] !== undefined) {
// turn into array
result[decodeURIComponent(key)] = [
result[decodeURIComponent(key)]
].concat(decodeURIComponent(value));
switch (state) {
case 0:
if (char !== eq) {
key += char;
} else {
// set value
result[decodeURIComponent(key)] = decodeURIComponent(value);
if (!(decodeURIComponent(key) in result)) {
result[decodeURIComponent(key)] = undefined;
}
state = 1;
parsedKeys += 1;
}
key = "";
value = "";
keyOrValue = 0;
break;
default:
if (keyOrValue === 1) {
case 1:
case 2:
if (char !== sep && char !== undefined) {
value += char;
} else {
key += char;
if (Array.isArray(result[decodeURIComponent(key)])) {
// concat array
result[decodeURIComponent(key)].concat(decodeURIComponent(value));
} else if (result[decodeURIComponent(key)] !== undefined) {
// turn into array
result[decodeURIComponent(key)] = [
result[decodeURIComponent(key)]
].concat(decodeURIComponent(value));
} else {
// set value
result[decodeURIComponent(key)] = decodeURIComponent(value);
}
key = "";
value = "";
state = 0;
}
break;
}
if (maxKeys !== 0 && parsedKeys > maxKeys) {
break;
}
}
return result;

@@ -92,0 +96,0 @@ }

{
"name": "isomorphic-querystring",
"version": "1.2.1",
"version": "1.2.2",
"license": "MIT",

@@ -17,3 +17,4 @@ "description": "isomorphic querystring interface for client & server.",

"devDependencies": {
"jest": "24.8.0"
"jest": "24.8.0",
"jest-in-case": "1.0.2"
},

@@ -20,0 +21,0 @@ "scripts": {

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