qs 6.4.2 → 6.4.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## **6.4.3**
2
+ - [Fix] fix regressions from robustness refactor
3
+ - [meta] add `npmignore` to autogenerate an npmignore file
4
+ - [actions] update reusable workflows
5
+
1
6
  ## **6.4.2**
2
7
  - [Robustness] avoid `.push`, use `void`
3
8
  - [readme] clarify `parseArrays` and `arrayLimit` documentation (#543)
package/dist/qs.js CHANGED
@@ -158,7 +158,7 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
158
158
  // If there's a remainder, just add whatever is left
159
159
 
160
160
  if (segment) {
161
- keys[keys.length] = '[' + key.slice(segment.index + ']');
161
+ keys[keys.length] = '[' + key.slice(segment.index) + ']';
162
162
  }
163
163
 
164
164
  return parseObject(keys, val, options);
@@ -425,7 +425,7 @@ var has = Object.prototype.hasOwnProperty;
425
425
  var hexTable = (function () {
426
426
  var array = [];
427
427
  for (var i = 0; i < 256; ++i) {
428
- array[array.length] = '%' + ((i < 16 ? '0' : '' + i.toString(16)).toUpperCase());
428
+ array[array.length] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
429
429
  }
430
430
 
431
431
  return array;
package/lib/parse.js CHANGED
@@ -124,7 +124,7 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
124
124
  // If there's a remainder, just add whatever is left
125
125
 
126
126
  if (segment) {
127
- keys[keys.length] = '[' + key.slice(segment.index + ']');
127
+ keys[keys.length] = '[' + key.slice(segment.index) + ']';
128
128
  }
129
129
 
130
130
  return parseObject(keys, val, options);
package/lib/utils.js CHANGED
@@ -5,7 +5,7 @@ var has = Object.prototype.hasOwnProperty;
5
5
  var hexTable = (function () {
6
6
  var array = [];
7
7
  for (var i = 0; i < 256; ++i) {
8
- array[array.length] = '%' + ((i < 16 ? '0' : '' + i.toString(16)).toUpperCase());
8
+ array[array.length] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
9
9
  }
10
10
 
11
11
  return array;
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.4.2",
5
+ "version": "6.4.3",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/ljharb/qs.git"
@@ -36,10 +36,11 @@
36
36
  "qs-iconv": "^1.0.4",
37
37
  "safe-publish-latest": "^2.0.0",
38
38
  "safer-buffer": "^2.1.2",
39
- "tape": "^5.4.0"
39
+ "tape": "^5.4.0",
40
+ "npmignore": "^0.3.1"
40
41
  },
41
42
  "scripts": {
42
- "prepublishOnly": "safe-publish-latest && npm run dist",
43
+ "prepublishOnly": "safe-publish-latest && npmignore --auto --commentLines=autogenerated && npm run dist",
43
44
  "prepublish": "not-in-publish || npm run prepublishOnly",
44
45
  "pretest": "npm run --silent readme && npm run --silent lint",
45
46
  "test": "npm run --silent tests-only",
@@ -50,5 +51,13 @@
50
51
  "lint": "eslint --ext=js,mjs .",
51
52
  "dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js"
52
53
  },
53
- "license": "BSD-3-Clause"
54
+ "license": "BSD-3-Clause",
55
+ "publishConfig": {
56
+ "ignore": [
57
+ "!dist/*",
58
+ "bower.json",
59
+ "component.json",
60
+ ".github/workflows"
61
+ ]
62
+ }
54
63
  }
package/test/parse.js CHANGED
@@ -51,6 +51,15 @@ test('parse()', function (t) {
51
51
  st.end();
52
52
  });
53
53
 
54
+ t.test('correctly computes the remainder when depth is exceeded', function (st) {
55
+ st.deepEqual(
56
+ qs.parse('a[b][c][d][e]=f', { depth: 2 }),
57
+ { a: { b: { c: { '[d][e]': 'f' } } } },
58
+ 'the remainder is "[d][e]", not the full original key'
59
+ );
60
+ st.end();
61
+ });
62
+
54
63
  t.deepEqual(qs.parse('a=b&a=c'), { a: ['b', 'c'] }, 'parses a simple array');
55
64
 
56
65
  t.test('parses an explicit array', function (st) {
package/test/stringify.js CHANGED
@@ -18,6 +18,12 @@ test('stringify()', function (t) {
18
18
  st.end();
19
19
  });
20
20
 
21
+ t.test('correctly encodes low-byte characters', function (st) {
22
+ st.equal(qs.stringify({ a: String.fromCharCode(1) }), 'a=%01', 'encodes 0x01');
23
+ st.equal(qs.stringify({ a: String.fromCharCode(15) }), 'a=%0F', 'encodes 0x0F');
24
+ st.end();
25
+ });
26
+
21
27
  t.test('stringifies a nested object', function (st) {
22
28
  st.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c');
23
29
  st.equal(qs.stringify({ a: { b: { c: { d: 'e' } } } }), 'a%5Bb%5D%5Bc%5D%5Bd%5D=e');
package/bower.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "name": "qs",
3
- "main": "dist/qs.js",
4
- "homepage": "https://github.com/hapijs/qs",
5
- "authors": [
6
- "Nathan LaFreniere <quitlahok@gmail.com>"
7
- ],
8
- "description": "A querystring parser that supports nesting and arrays, with a depth limit",
9
- "keywords": [
10
- "querystring",
11
- "qs"
12
- ],
13
- "license": "BSD-3-Clause",
14
- "ignore": [
15
- "**/.*",
16
- "node_modules",
17
- "bower_components",
18
- "test",
19
- "tests"
20
- ]
21
- }
package/component.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "name": "qs",
3
- "repository": "hapijs/qs",
4
- "description": "query-string parser / stringifier with nesting support",
5
- "version": "6.4.1",
6
- "keywords": ["querystring", "query", "parser"],
7
- "main": "lib/index.js",
8
- "scripts": [
9
- "lib/index.js",
10
- "lib/parse.js",
11
- "lib/stringify.js",
12
- "lib/utils.js"
13
- ],
14
- "license": "BSD-3-Clause"
15
- }