qs 6.1.3 → 6.1.4

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/dist/qs.js CHANGED
@@ -137,7 +137,7 @@ internals.parseKeys = function (givenKey, val, options) {
137
137
  // If there's a remainder, just add whatever is left
138
138
 
139
139
  if (segment) {
140
- keys[keys.length] = '[' + key.slice(segment.index + ']');
140
+ keys[keys.length] = '[' + key.slice(segment.index) + ']';
141
141
  }
142
142
 
143
143
  return internals.parseObject(keys, val, options);
package/lib/parse.js CHANGED
@@ -125,7 +125,7 @@ internals.parseKeys = function (givenKey, val, options) {
125
125
  // If there's a remainder, just add whatever is left
126
126
 
127
127
  if (segment) {
128
- keys[keys.length] = '[' + key.slice(segment.index + ']');
128
+ keys[keys.length] = '[' + key.slice(segment.index) + ']';
129
129
  }
130
130
 
131
131
  return internals.parseObject(keys, val, options);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "qs",
3
3
  "description": "A querystring parser that supports nesting and arrays, with a depth limit",
4
4
  "homepage": "https://github.com/ljharb/qs",
5
- "version": "6.1.3",
5
+ "version": "6.1.4",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/ljharb/qs.git"
@@ -31,7 +31,8 @@
31
31
  "eslint": "^1.10.3",
32
32
  "@ljharb/eslint-config": "^1.6.1",
33
33
  "parallelshell": "^2.0.0",
34
- "evalmd": "^0.0.16"
34
+ "evalmd": "^0.0.16",
35
+ "npmignore": "^0.3.1"
35
36
  },
36
37
  "scripts": {
37
38
  "pretest": "npm run lint && npm run readme",
@@ -41,7 +42,16 @@
41
42
  "lint": "eslint lib/*.js text/*.js",
42
43
  "coverage": "covert test",
43
44
  "dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js",
44
- "prepublish": "npm run dist"
45
+ "prepublish": "npmignore --auto --commentLines=autogenerated && npm run dist"
45
46
  },
46
- "license": "BSD-3-Clause"
47
+ "license": "BSD-3-Clause",
48
+ "publishConfig": {
49
+ "ignore": [
50
+ "!dist/*",
51
+ "bower.json",
52
+ "component.json",
53
+ ".github/workflows",
54
+ ".travis.yml"
55
+ ]
56
+ }
47
57
  }
package/test/parse.js CHANGED
@@ -49,6 +49,15 @@ test('parse()', function (t) {
49
49
  st.end();
50
50
  });
51
51
 
52
+ t.test('correctly computes the remainder when depth is exceeded', function (st) {
53
+ st.deepEqual(
54
+ qs.parse('a[b][c][d][e]=f', { depth: 2 }),
55
+ { a: { b: { c: { '[d][e]': 'f' } } } },
56
+ 'the remainder is "[d][e]", not the full original key'
57
+ );
58
+ st.end();
59
+ });
60
+
52
61
  t.deepEqual(qs.parse('a=b&a=c'), { a: ['b', 'c'] }, 'parses a simple array');
53
62
 
54
63
  t.test('parses an explicit array', function (st) {