Socket
Socket
Sign inDemoInstall

qs

Package Overview
Dependencies
0
Maintainers
3
Versions
110
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.9.0 to 6.9.1

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## **6.9.1**
- [Fix] `parse`: with comma true, handle field that holds an array of arrays (#335)
- [Fix] `parse`: with comma true, do not split non-string values (#334)
- [meta] add `funding` field
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`
- [Tests] use shared travis-ci config
## **6.9.0**

@@ -2,0 +9,0 @@ - [New] `parse`/`stringify`: Pass extra key/value argument to `decoder` (#333)

8

dist/qs.js

@@ -48,2 +48,3 @@ (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 has = Object.prototype.hasOwnProperty;
var isArray = Array.isArray;

@@ -129,6 +130,10 @@ var defaults = {

if (val && options.comma && val.indexOf(',') > -1) {
if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
val = val.split(',');
}
if (part.indexOf('[]=') > -1) {
val = isArray(val) ? [val] : val;
}
if (has.call(obj, key)) {

@@ -616,2 +621,3 @@ obj[key] = utils.combine(obj[key], val);

var merge = function merge(target, source, options) {
/* eslint no-param-reassign: 0 */
if (!source) {

@@ -618,0 +624,0 @@ return target;

@@ -6,2 +6,3 @@ 'use strict';

var has = Object.prototype.hasOwnProperty;
var isArray = Array.isArray;

@@ -87,6 +88,10 @@ var defaults = {

if (val && options.comma && val.indexOf(',') > -1) {
if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
val = val.split(',');
}
if (part.indexOf('[]=') > -1) {
val = isArray(val) ? [val] : val;
}
if (has.call(obj, key)) {

@@ -93,0 +98,0 @@ obj[key] = utils.combine(obj[key], val);

@@ -46,2 +46,3 @@ 'use strict';

var merge = function merge(target, source, options) {
/* eslint no-param-reassign: 0 */
if (!source) {

@@ -48,0 +49,0 @@ return target;

9

package.json

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

"homepage": "https://github.com/ljharb/qs",
"version": "6.9.0",
"version": "6.9.1",
"repository": {

@@ -11,2 +11,5 @@ "type": "git",

},
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"main": "lib/index.js",

@@ -33,7 +36,7 @@ "contributors": [

"devDependencies": {
"@ljharb/eslint-config": "^14.1.0",
"@ljharb/eslint-config": "^15.0.0",
"browserify": "^16.5.0",
"covert": "^1.1.1",
"eclint": "^2.8.1",
"eslint": "^6.4.0",
"eslint": "^6.6.0",
"evalmd": "^0.0.19",

@@ -40,0 +43,0 @@ "for-each": "^0.3.3",

@@ -403,2 +403,25 @@ 'use strict';

t.test('use number decoder, parses string that has one number with comma option enabled', function (st) {
var decoder = function (str, defaultDecoder, charset, type) {
if (!isNaN(Number(str))) {
return parseFloat(str);
}
return defaultDecoder(str, defaultDecoder, charset, type);
};
st.deepEqual(qs.parse('foo=1', { comma: true, decoder: decoder }), { foo: 1 });
st.deepEqual(qs.parse('foo=0', { comma: true, decoder: decoder }), { foo: 0 });
st.end();
});
t.test('parses brackets holds array of arrays when having two parts of strings with comma as array divider', function (st) {
st.deepEqual(qs.parse('foo[]=1,2,3&foo[]=4,5,6', { comma: true }), { foo: [['1', '2', '3'], ['4', '5', '6']] });
st.deepEqual(qs.parse('foo[]=1,2,3&foo[]=', { comma: true }), { foo: [['1', '2', '3'], ''] });
st.deepEqual(qs.parse('foo[]=1,2,3&foo[]=,', { comma: true }), { foo: [['1', '2', '3'], ['', '']] });
st.deepEqual(qs.parse('foo[]=1,2,3&foo[]=a', { comma: true }), { foo: [['1', '2', '3'], 'a'] });
st.end();
});
t.test('parses an object in dot notation', function (st) {

@@ -405,0 +428,0 @@ var input = {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc