qs 6.5.4 → 6.5.5

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.5.5**
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.5.4**
2
7
  - [Robustness] avoid `.push`, use `void`
3
8
  - [readme] clarify `parseArrays` and `arrayLimit` documentation (#543)
package/dist/qs.js CHANGED
@@ -164,7 +164,7 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
164
164
  // If there's a remainder, just add whatever is left
165
165
 
166
166
  if (segment) {
167
- keys[keys.length] = '[' + key.slice(segment.index + ']');
167
+ keys[keys.length] = '[' + key.slice(segment.index) + ']';
168
168
  }
169
169
 
170
170
  return parseObject(keys, val, options);
@@ -435,7 +435,7 @@ var has = Object.prototype.hasOwnProperty;
435
435
  var hexTable = (function () {
436
436
  var array = [];
437
437
  for (var i = 0; i < 256; ++i) {
438
- array[array.length] = '%' + ((i < 16 ? '0' : '' + i.toString(16)).toUpperCase());
438
+ array[array.length] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
439
439
  }
440
440
 
441
441
  return array;
package/lib/parse.js CHANGED
@@ -130,7 +130,7 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
130
130
  // If there's a remainder, just add whatever is left
131
131
 
132
132
  if (segment) {
133
- keys[keys.length] = '[' + key.slice(segment.index + ']');
133
+ keys[keys.length] = '[' + key.slice(segment.index) + ']';
134
134
  }
135
135
 
136
136
  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.5.4",
5
+ "version": "6.5.5",
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
@@ -52,6 +52,15 @@ test('parse()', function (t) {
52
52
  st.end();
53
53
  });
54
54
 
55
+ t.test('correctly computes the remainder when depth is exceeded', function (st) {
56
+ st.deepEqual(
57
+ qs.parse('a[b][c][d][e]=f', { depth: 2 }),
58
+ { a: { b: { c: { '[d][e]': 'f' } } } },
59
+ 'the remainder is "[d][e]", not the full original key'
60
+ );
61
+ st.end();
62
+ });
63
+
55
64
  t.deepEqual(qs.parse('a=b&a=c'), { a: ['b', 'c'] }, 'parses a simple array');
56
65
 
57
66
  t.test('parses an explicit array', function (st) {
package/test/stringify.js CHANGED
@@ -19,6 +19,12 @@ test('stringify()', function (t) {
19
19
  st.end();
20
20
  });
21
21
 
22
+ t.test('correctly encodes low-byte characters', function (st) {
23
+ st.equal(qs.stringify({ a: String.fromCharCode(1) }), 'a=%01', 'encodes 0x01');
24
+ st.equal(qs.stringify({ a: String.fromCharCode(15) }), 'a=%0F', 'encodes 0x0F');
25
+ st.end();
26
+ });
27
+
22
28
  t.test('stringifies falsy values', function (st) {
23
29
  st.equal(qs.stringify(undefined), '');
24
30
  st.equal(qs.stringify(null), '');
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": "ljharb/qs",
4
- "description": "query-string parser / stringifier with nesting support",
5
- "version": "6.5.3",
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
- }