Skip to content

Commit 7d4670f

Browse files
committed
[Dev Deps] backport from main
1 parent 0485440 commit 7d4670f

15 files changed

+215
-129
lines changed

.editorconfig

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
43+
[.nycrc]
44+
indent_style = tab

.eslintignore

-1
This file was deleted.

.eslintrc

+23-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,35 @@
33

44
"extends": "@ljharb",
55

6+
"ignorePatterns": [
7+
"dist/",
8+
],
9+
610
"rules": {
7-
"complexity": [2, 26],
11+
"complexity": [2, 29],
812
"consistent-return": 1,
13+
"func-name-matching": 0,
914
"id-length": [2, { "min": 1, "max": 25, "properties": "never" }],
1015
"indent": [2, 4],
16+
"max-lines-per-function": 0,
1117
"max-params": [2, 12],
12-
"max-statements": [2, 43],
18+
"max-statements": [2, 45],
19+
"multiline-comment-style": 0,
1320
"no-continue": 1,
1421
"no-magic-numbers": 0,
22+
"no-param-reassign": 1,
1523
"no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"],
16-
"operator-linebreak": [2, "after"],
17-
}
24+
},
25+
26+
"overrides": [
27+
{
28+
"files": "test/**",
29+
"rules": {
30+
"max-lines-per-function": 0,
31+
"max-statements": 0,
32+
"no-extend-native": 0,
33+
"function-paren-newline": 0,
34+
},
35+
},
36+
],
1837
}

.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+
}

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.4.0",
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.4.0",
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 parseObjectRecursive(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 parseQueryStringKeys(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

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ var utils = require('./utils');
44
var formats = require('./formats');
55

66
var arrayPrefixGenerators = {
7-
brackets: function brackets(prefix) { // eslint-disable-line func-name-matching
7+
brackets: function brackets(prefix) {
88
return prefix + '[]';
99
},
10-
indices: function indices(prefix, key) { // eslint-disable-line func-name-matching
10+
indices: function indices(prefix, key) {
1111
return prefix + '[' + key + ']';
1212
},
13-
repeat: function repeat(prefix) { // eslint-disable-line func-name-matching
13+
repeat: function repeat(prefix) {
1414
return prefix;
1515
}
1616
};
@@ -28,14 +28,14 @@ var defaults = {
2828
encode: true,
2929
encoder: utils.encode,
3030
encodeValuesOnly: false,
31-
serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching
31+
serializeDate: function serializeDate(date) {
3232
return toISO.call(date);
3333
},
3434
skipNulls: false,
3535
strictNullHandling: false
3636
};
3737

38-
var stringify = function stringify( // eslint-disable-line func-name-matching
38+
var stringify = function stringify(
3939
object,
4040
prefix,
4141
generateArrayPrefix,
@@ -147,7 +147,7 @@ module.exports = function (object, opts) {
147147
var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate;
148148
var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly;
149149
if (typeof options.format === 'undefined') {
150-
options.format = formats.default;
150+
options.format = formats['default'];
151151
} else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {
152152
throw new TypeError('Unknown format option provided.');
153153
}

lib/utils.js

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

101101
if (
102-
c === 0x2D || // -
103-
c === 0x2E || // .
104-
c === 0x5F || // _
105-
c === 0x7E || // ~
106-
(c >= 0x30 && c <= 0x39) || // 0-9
107-
(c >= 0x41 && c <= 0x5A) || // a-z
108-
(c >= 0x61 && c <= 0x7A) // A-Z
102+
c === 0x2D // -
103+
|| c === 0x2E // .
104+
|| c === 0x5F // _
105+
|| c === 0x7E // ~
106+
|| (c >= 0x30 && c <= 0x39) // 0-9
107+
|| (c >= 0x41 && c <= 0x5A) // a-z
108+
|| (c >= 0x61 && c <= 0x7A) // A-Z
109109
) {
110110
out += string.charAt(i);
111111
continue;
@@ -128,7 +128,11 @@ exports.encode = function (str) {
128128

129129
i += 1;
130130
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
131-
out += hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]; // eslint-disable-line max-len
131+
/* eslint operator-linebreak: [2, "before"] */
132+
out += hexTable[0xF0 | (c >> 18)]
133+
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
134+
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
135+
+ hexTable[0x80 | (c & 0x3F)];
132136
}
133137

134138
return out;

0 commit comments

Comments
 (0)