Skip to content

Commit f047c9d

Browse files
committed
[Dev Deps] backport from main
1 parent 5f8e28b commit f047c9d

16 files changed

+280
-146
lines changed

.editorconfig

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
max_line_length = 160
11+
quote_type = single
12+
13+
[test/*]
14+
max_line_length = off
15+
16+
[*.md]
17+
indent_size = off
18+
max_line_length = off
19+
20+
[*.json]
21+
max_line_length = off
22+
23+
[Makefile]
24+
max_line_length = off
25+
26+
[CHANGELOG.md]
27+
indent_style = space
28+
indent_size = 2
29+
30+
[LICENSE]
31+
indent_size = 2
32+
max_line_length = off
33+
34+
[coverage/**/*]
35+
indent_size = off
36+
indent_style = off
37+
indent = off
38+
max_line_length = off
39+
40+
[dist/*]
41+
max_line_length = off
42+
insert_final_newline = off
43+
44+
[.nycrc]
45+
indent_style = off

.eslintignore

-1
This file was deleted.

.eslintrc

+24-8
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,37 @@
33

44
"extends": "@ljharb",
55

6+
"ignorePatterns": [
7+
"dist/",
8+
],
9+
610
"rules": {
7-
"complexity": [2, 25],
8-
"consistent-return": [1],
11+
"complexity": [2, 29],
12+
"consistent-return": 1,
913
"func-name-matching": 0,
1014
"id-length": [2, { "min": 1, "max": 25, "properties": "never" }],
1115
"indent": [2, 4],
12-
"max-len": 0,
1316
"max-lines-per-function": 0,
14-
"max-params": [2, 9],
15-
"max-statements": [0, 36],
16-
"no-extra-parens": [1],
17-
"no-continue": [1],
17+
"max-lines": 0,
18+
"max-params": [2, 12],
19+
"max-statements": [2, 45],
20+
"multiline-comment-style": 0,
21+
"no-continue": 1,
1822
"no-magic-numbers": 0,
23+
"no-param-reassign": 1,
1924
"no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"],
20-
"operator-linebreak": 1,
2125
"sort-keys": 0,
2226
},
27+
28+
"overrides": [
29+
{
30+
"files": "test/**",
31+
"rules": {
32+
"max-lines-per-function": 0,
33+
"max-statements": 0,
34+
"no-extend-native": 0,
35+
"function-paren-newline": 0,
36+
},
37+
},
38+
],
2339
}

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@ lib-cov
1818
complexity.md
1919
tests.tap
2020
dist/*
21+
22+
# Only apps should have lockfiles
23+
yarn.lock
24+
package-lock.json
25+
npm-shrinkwrap.json
26+
27+
.nyc_output/
28+
coverage/

.npmignore

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
bower.json
2-
component.json
3-
.npmignore
4-
.travis.yml
1+
# gitignore
2+
npm-debug.log
3+
node_modules
4+
.DS_Store
5+
6+
# Only apps should have lockfiles
7+
yarn.lock
8+
package-lock.json
9+
npm-shrinkwrap.json
10+
11+
.nyc_output/
12+
coverage/
13+
14+
.github/workflows

.nycrc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"all": true,
3+
"check-coverage": false,
4+
"reporter": ["text-summary", "text", "html", "json"],
5+
"lines": 86,
6+
"statements": 85.93,
7+
"functions": 82.43,
8+
"branches": 76.06,
9+
"exclude": [
10+
"coverage",
11+
"dist"
12+
]
13+
}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ assert.equal(nullsSkipped, 'a=b');
380380

381381
### Dealing with special character sets
382382

383-
By default the encoding and decoding of characters is done in `utf-8`. If you
383+
By default the encoding and decoding of characters is done in `utf-8`. If you
384384
wish to encode querystrings to a different character set (i.e.
385385
[Shift JIS](https://en.wikipedia.org/wiki/Shift_JIS)) you can use the
386386
[`qs-iconv`](https://github.com/martinheidegger/qs-iconv) library:

bower.json

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
2-
"name": "qs",
3-
"main": "dist/qs.js",
4-
"homepage": "https://github.com/hapijs/qs",
5-
"authors": [
6-
"Nathan LaFreniere <[email protected]>"
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-
]
2+
"name": "qs",
3+
"main": "dist/qs.js",
4+
"homepage": "https://github.com/hapijs/qs",
5+
"authors": [
6+
"Nathan LaFreniere <[email protected]>"
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+
]
2121
}

component.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"name": "qs",
3-
"repository": "hapijs/qs",
4-
"description": "query-string parser / stringifier with nesting support",
5-
"version": "6.2.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"
2+
"name": "qs",
3+
"repository": "hapijs/qs",
4+
"description": "query-string parser / stringifier with nesting support",
5+
"version": "6.2.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"
1515
}

lib/parse.js

+6-9
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ var parseObject = function parseObject(chain, val, options) {
6060
if (!options.parseArrays && cleanRoot === '') {
6161
obj = { 0: val };
6262
} else if (
63-
!isNaN(index) &&
64-
root !== cleanRoot &&
65-
String(index) === cleanRoot &&
66-
index >= 0 &&
67-
(options.parseArrays && index <= options.arrayLimit)
63+
!isNaN(index)
64+
&& root !== cleanRoot
65+
&& String(index) === cleanRoot
66+
&& index >= 0
67+
&& (options.parseArrays && index <= options.arrayLimit)
6868
) {
6969
obj = [];
7070
obj[index] = parseObject(chain, val, options);
@@ -98,10 +98,7 @@ var parseKeys = function parseKeys(givenKey, val, options) {
9898

9999
var keys = [];
100100
if (parent) {
101-
/*
102-
* If we aren't using plain objects, optionally prefix keys
103-
* that would overwrite object prototype properties
104-
*/
101+
// If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
105102
if (!options.plainObjects && has.call(Object.prototype, parent)) {
106103
if (!options.allowPrototypes) {
107104
return;

lib/stringify.js

+44-5
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,17 @@ var defaults = {
2323
};
2424

2525
var isArray = Array.isArray;
26-
27-
var stringify = function stringify(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots) {
26+
var stringify = function stringify(
27+
object,
28+
prefix,
29+
generateArrayPrefix,
30+
strictNullHandling,
31+
skipNulls,
32+
encoder,
33+
filter,
34+
sort,
35+
allowDots
36+
) {
2837
var obj = object;
2938
if (typeof filter === 'function') {
3039
obj = filter(prefix, obj);
@@ -67,9 +76,29 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNu
6776
}
6877

6978
if (isArray(obj)) {
70-
values = values.concat(stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots));
79+
values = values.concat(stringify(
80+
obj[key],
81+
generateArrayPrefix(prefix, key),
82+
generateArrayPrefix,
83+
strictNullHandling,
84+
skipNulls,
85+
encoder,
86+
filter,
87+
sort,
88+
allowDots
89+
));
7190
} else {
72-
values = values.concat(stringify(obj[key], prefix + (allowDots ? '.' + key : '[' + key + ']'), generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots));
91+
values = values.concat(stringify(
92+
obj[key],
93+
prefix + (allowDots ? '.' + key : '[' + key + ']'),
94+
generateArrayPrefix,
95+
strictNullHandling,
96+
skipNulls,
97+
encoder,
98+
filter,
99+
sort,
100+
allowDots
101+
));
73102
}
74103
}
75104

@@ -133,7 +162,17 @@ module.exports = function (object, opts) {
133162
continue;
134163
}
135164

136-
keys = keys.concat(stringify(obj[key], key, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots));
165+
keys = keys.concat(stringify(
166+
obj[key],
167+
key,
168+
generateArrayPrefix,
169+
strictNullHandling,
170+
skipNulls,
171+
encoder,
172+
filter,
173+
sort,
174+
allowDots
175+
));
137176
}
138177

139178
return keys.join(delimiter);

lib/utils.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ exports.encode = function (str) {
114114
var c = string.charCodeAt(i);
115115

116116
if (
117-
c === 0x2D || // -
118-
c === 0x2E || // .
119-
c === 0x5F || // _
120-
c === 0x7E || // ~
121-
(c >= 0x30 && c <= 0x39) || // 0-9
122-
(c >= 0x41 && c <= 0x5A) || // a-z
123-
(c >= 0x61 && c <= 0x7A) // A-Z
117+
c === 0x2D // -
118+
|| c === 0x2E // .
119+
|| c === 0x5F // _
120+
|| c === 0x7E // ~
121+
|| (c >= 0x30 && c <= 0x39) // 0-9
122+
|| (c >= 0x41 && c <= 0x5A) // a-z
123+
|| (c >= 0x61 && c <= 0x7A) // A-Z
124124
) {
125125
out += string.charAt(i);
126126
continue;
@@ -143,7 +143,11 @@ exports.encode = function (str) {
143143

144144
i += 1;
145145
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
146-
out += hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)];
146+
/* eslint operator-linebreak: [2, "before"] */
147+
out += hexTable[0xF0 | (c >> 18)]
148+
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
149+
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
150+
+ hexTable[0x80 | (c & 0x3F)];
147151
}
148152

149153
return out;

0 commit comments

Comments
 (0)