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

qs

Package Overview
Dependencies
Maintainers
3
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qs - npm Package Compare versions

Comparing version 6.8.1 to 6.8.2

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## **6.8.2**
- [Fix] proper comma parsing of URL-encoded commas (#361)
- [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336)
## **6.8.1**

@@ -2,0 +6,0 @@ - [Fix] `parse`: Fix parsing array from object with `comma` true (#359)

32

dist/qs.js

@@ -82,2 +82,13 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Qs = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){

var maybeMap = function maybeMap(val, fn) {
if (isArray(val)) {
var mapped = [];
for (var i = 0; i < val.length; i += 1) {
mapped.push(fn(val[i]));
}
return mapped;
}
return fn(val);
};
// This is what browsers will submit when the ✓ character occurs in an

@@ -131,3 +142,8 @@ // application/x-www-form-urlencoded body and the encoding of the page containing

key = options.decoder(part.slice(0, pos), defaults.decoder, charset);
val = options.decoder(part.slice(pos + 1), defaults.decoder, charset);
val = maybeMap(
parseArrayValue(part.slice(pos + 1), options),
function (encodedVal) {
return options.decoder(encodedVal, defaults.decoder, charset);
}
);
}

@@ -139,4 +155,2 @@

val = parseArrayValue(val, options);
if (part.indexOf('[]=') > -1) {

@@ -156,4 +170,4 @@ val = isArray(val) ? [val] : val;

var parseObject = function (chain, val, options) {
var leaf = parseArrayValue(val, options);
var parseObject = function (chain, val, options, valuesParsed) {
var leaf = valuesParsed ? val : parseArrayValue(val, options);

@@ -186,3 +200,3 @@ for (var i = chain.length - 1; i >= 0; --i) {

leaf = obj;
leaf = obj; // eslint-disable-line no-param-reassign
}

@@ -193,3 +207,3 @@

var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
if (!givenKey) {

@@ -245,3 +259,3 @@ return;

return parseObject(keys, val, options);
return parseObject(keys, val, options, valuesParsed);
};

@@ -298,3 +312,3 @@

var key = keys[i];
var newObj = parseKeys(key, tempObj[key], options);
var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
obj = utils.merge(obj, newObj, options);

@@ -301,0 +315,0 @@ }

@@ -40,2 +40,13 @@ 'use strict';

var maybeMap = function maybeMap(val, fn) {
if (isArray(val)) {
var mapped = [];
for (var i = 0; i < val.length; i += 1) {
mapped.push(fn(val[i]));
}
return mapped;
}
return fn(val);
};
// This is what browsers will submit when the ✓ character occurs in an

@@ -89,3 +100,8 @@ // application/x-www-form-urlencoded body and the encoding of the page containing

key = options.decoder(part.slice(0, pos), defaults.decoder, charset);
val = options.decoder(part.slice(pos + 1), defaults.decoder, charset);
val = maybeMap(
parseArrayValue(part.slice(pos + 1), options),
function (encodedVal) {
return options.decoder(encodedVal, defaults.decoder, charset);
}
);
}

@@ -97,4 +113,2 @@

val = parseArrayValue(val, options);
if (part.indexOf('[]=') > -1) {

@@ -114,4 +128,4 @@ val = isArray(val) ? [val] : val;

var parseObject = function (chain, val, options) {
var leaf = parseArrayValue(val, options);
var parseObject = function (chain, val, options, valuesParsed) {
var leaf = valuesParsed ? val : parseArrayValue(val, options);

@@ -144,3 +158,3 @@ for (var i = chain.length - 1; i >= 0; --i) {

leaf = obj;
leaf = obj; // eslint-disable-line no-param-reassign
}

@@ -151,3 +165,3 @@

var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
if (!givenKey) {

@@ -203,3 +217,3 @@ return;

return parseObject(keys, val, options);
return parseObject(keys, val, options, valuesParsed);
};

@@ -256,3 +270,3 @@

var key = keys[i];
var newObj = parseKeys(key, tempObj[key], options);
var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
obj = utils.merge(obj, newObj, options);

@@ -259,0 +273,0 @@ }

@@ -5,3 +5,3 @@ {

"homepage": "https://github.com/ljharb/qs",
"version": "6.8.1",
"version": "6.8.2",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

@@ -432,2 +432,10 @@ 'use strict';

t.test('parses comma delimited array while having percent-encoded comma treated as normal text', function (st) {
st.deepEqual(qs.parse('foo=a%2Cb', { comma: true }), { foo: 'a,b' });
st.deepEqual(qs.parse('foo=a%2C%20b,d', { comma: true }), { foo: ['a, b', 'd'] });
st.deepEqual(qs.parse('foo=a%2C%20b,c%2C%20d', { comma: true }), { foo: ['a, b', 'c, d'] });
st.end();
});
t.test('parses an object in dot notation', function (st) {

@@ -434,0 +442,0 @@ var input = {

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