qs 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintignore ADDED
@@ -0,0 +1 @@
1
+ dist
package/CHANGELOG.md CHANGED
@@ -1,4 +1,19 @@
1
1
 
2
+ ## [**3.1.0**](https://github.com/hapijs/qs/issues?milestone=24&state=open)
3
+ - [**#89**](https://github.com/hapijs/qs/issues/89) Add option to disable "Transform dot notation to bracket notation"
4
+
5
+ ## [**3.0.0**](https://github.com/hapijs/qs/issues?milestone=23&state=closed)
6
+ - [**#77**](https://github.com/hapijs/qs/issues/77) Perf boost
7
+ - [**#60**](https://github.com/hapijs/qs/issues/60) Add explicit option to disable array parsing
8
+ - [**#80**](https://github.com/hapijs/qs/issues/80) qs.parse silently drops properties
9
+ - [**#74**](https://github.com/hapijs/qs/issues/74) Bad parse when turning array into object
10
+ - [**#81**](https://github.com/hapijs/qs/issues/81) Add a `filter` option
11
+ - [**#68**](https://github.com/hapijs/qs/issues/68) Fixed issue with recursion and passing strings into objects.
12
+ - [**#66**](https://github.com/hapijs/qs/issues/66) Add mixed array and object dot notation support Closes: #47
13
+ - [**#76**](https://github.com/hapijs/qs/issues/76) RFC 3986
14
+ - [**#85**](https://github.com/hapijs/qs/issues/85) No equal sign
15
+ - [**#84**](https://github.com/hapijs/qs/issues/84) update license attribute
16
+
2
17
  ## [**2.4.1**](https://github.com/hapijs/qs/issues?milestone=20&state=closed)
3
18
  - [**#73**](https://github.com/hapijs/qs/issues/73) Property 'hasOwnProperty' of object #<Object> is not a function
4
19
 
package/lib/parse.js CHANGED
@@ -92,7 +92,9 @@ internals.parseKeys = function (key, val, options) {
92
92
 
93
93
  // Transform dot notation to bracket notation
94
94
 
95
- key = key.replace(/\.([^\.\[]+)/g, '[$1]');
95
+ if (options.allowDots) {
96
+ key = key.replace(/\.([^\.\[]+)/g, '[$1]');
97
+ }
96
98
 
97
99
  // The regex chunks
98
100
 
@@ -143,6 +145,7 @@ module.exports = function (str, options) {
143
145
  options.depth = typeof options.depth === 'number' ? options.depth : internals.depth;
144
146
  options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit;
145
147
  options.parseArrays = options.parseArrays !== false;
148
+ options.allowDots = options.allowDots !== false;
146
149
  options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit;
147
150
  options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling;
148
151
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qs",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "A querystring parser that supports nesting and arrays, with a depth limit",
5
5
  "homepage": "https://github.com/hapijs/qs",
6
6
  "main": "index.js",
package/test/parse.js CHANGED
@@ -47,6 +47,13 @@ describe('parse()', function () {
47
47
  done();
48
48
  });
49
49
 
50
+ it('allows disabling dot notation', function (done) {
51
+
52
+ expect(Qs.parse('a.b=c')).to.deep.equal({ a: { b: 'c' } }, { prototype: false });
53
+ expect(Qs.parse('a.b=c', { allowDots: false })).to.deep.equal({ 'a.b': 'c' }, { prototype: false });
54
+ done();
55
+ });
56
+
50
57
  it('parses a single nested string', function (done) {
51
58
 
52
59
  expect(Qs.parse('a[b]=c')).to.deep.equal({ a: { b: 'c' } }, { prototype: false });