Comparing version 6.9.2 to 6.9.3
@@ -0,1 +1,5 @@ | ||
## **6.9.3** | ||
- [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.9.2** | ||
@@ -25,2 +29,19 @@ - [Fix] `parse`: Fix parsing array from object with `comma` true (#359) | ||
## **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** | ||
- [Fix] `parse`: Fix parsing array from object with `comma` true (#359) | ||
- [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349) | ||
- [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 tidelift marketing copy | ||
- [meta] add `funding` field | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `safe-publish-latest`, `evalmd`, `has-symbols`, `iconv-lite`, `mkdirp`, `object-inspect` | ||
- [Tests] `parse`: add passing `arrayFormat` tests | ||
- [Tests] use shared travis-ci configs | ||
- [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray | ||
- [actions] add automatic rebasing / merge commit blocking | ||
## **6.8.0** | ||
@@ -40,2 +61,26 @@ - [New] add `depth=false` to preserve the original key; [Fix] `depth=0` should preserve the original key (#326) | ||
## **6.7.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.7.1** | ||
- [Fix] `parse`: Fix parsing array from object with `comma` true (#359) | ||
- [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) | ||
- [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349) | ||
- [Fix] fix for an impossible situation: when the formatter is called with a non-string value | ||
- [Refactor] `formats`: tiny bit of cleanup. | ||
- readme: add security note | ||
- [meta] add tidelift marketing copy | ||
- [meta] add `funding` field | ||
- [meta] add FUNDING.yml | ||
- [meta] Clean up license text so it’s properly detected as BSD-3-Clause | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `safe-publish-latest`, `evalmd`, `iconv-lite`, `mkdirp`, `object-inspect`, `browserify` | ||
- [Tests] `parse`: add passing `arrayFormat` tests | ||
- [Tests] use shared travis-ci configs | ||
- [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray | ||
- [Tests] add tests for `depth=0` and `depth=false` behavior, both current and intuitive/intended | ||
- [Tests] use `eclint` instead of `editorconfig-tools` | ||
- [actions] add automatic rebasing / merge commit blocking | ||
## **6.7.0** | ||
@@ -42,0 +87,0 @@ - [New] `stringify`/`parse`: add `comma` as an `arrayFormat` option (#276, #219) |
@@ -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, 'key'); | ||
val = options.decoder(part.slice(pos + 1), defaults.decoder, charset, 'value'); | ||
val = maybeMap( | ||
parseArrayValue(part.slice(pos + 1), options), | ||
function (encodedVal) { | ||
return options.decoder(encodedVal, defaults.decoder, charset, 'value'); | ||
} | ||
); | ||
} | ||
@@ -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, 'key'); | ||
val = options.decoder(part.slice(pos + 1), defaults.decoder, charset, 'value'); | ||
val = maybeMap( | ||
parseArrayValue(part.slice(pos + 1), options), | ||
function (encodedVal) { | ||
return options.decoder(encodedVal, defaults.decoder, charset, 'value'); | ||
} | ||
); | ||
} | ||
@@ -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.9.2", | ||
"version": "6.9.3", | ||
"repository": { | ||
@@ -44,3 +44,3 @@ "type": "git", | ||
"iconv-lite": "^0.5.1", | ||
"mkdirp": "^0.5.3", | ||
"mkdirp": "^0.5.4", | ||
"object-inspect": "^1.7.0", | ||
@@ -57,3 +57,3 @@ "qs-iconv": "^1.0.4", | ||
"tests-only": "node test", | ||
"posttest": "npx aud", | ||
"posttest": "npx aud --production", | ||
"readme": "evalmd README.md", | ||
@@ -60,0 +60,0 @@ "postlint": "eclint check * lib/* test/*", |
@@ -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 = { |
160076
2798