Skip to content

Commit

Permalink
[Dev Deps] update eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Sep 21, 2019
1 parent 7f216ee commit df0cb44
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
12 changes: 6 additions & 6 deletions dist/qs.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ var parseValues = function parseQueryStringValues(str, options) {

var key, val;
if (pos === -1) {
key = options.decoder(part, defaults.decoder, charset);
key = options.decoder(part, defaults.decoder, charset, 'key');
val = options.strictNullHandling ? null : '';
} else {
key = options.decoder(part.slice(0, pos), defaults.decoder, charset);
val = options.decoder(part.slice(pos + 1), defaults.decoder, charset);
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
val = options.decoder(part.slice(pos + 1), defaults.decoder, charset, 'value');
}

if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
Expand Down Expand Up @@ -367,16 +367,16 @@ var stringify = function stringify( // eslint-disable-line func-name-matching

if (obj === null) {
if (strictNullHandling) {
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset) : prefix;
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key') : prefix;
}

obj = '';
}

if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
if (encoder) {
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset);
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset))];
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key');
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value'))];
}
return [formatter(prefix) + '=' + formatter(String(obj))];
}
Expand Down
14 changes: 7 additions & 7 deletions lib/stringify.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ var formats = require('./formats');
var has = Object.prototype.hasOwnProperty;

var arrayPrefixGenerators = {
brackets: function brackets(prefix) { // eslint-disable-line func-name-matching
brackets: function brackets(prefix) {
return prefix + '[]';
},
comma: 'comma',
indices: function indices(prefix, key) { // eslint-disable-line func-name-matching
indices: function indices(prefix, key) {
return prefix + '[' + key + ']';
},
repeat: function repeat(prefix) { // eslint-disable-line func-name-matching
repeat: function repeat(prefix) {
return prefix;
}
};
Expand All @@ -39,22 +39,22 @@ var defaults = {
formatter: formats.formatters[defaultFormat],
// deprecated
indices: false,
serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching
serializeDate: function serializeDate(date) {
return toISO.call(date);
},
skipNulls: false,
strictNullHandling: false
};

var isNonNullishPrimitive = function isNonNullishPrimitive(v) { // eslint-disable-line func-name-matching
var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
return typeof v === 'string'
|| typeof v === 'number'
|| typeof v === 'boolean'
|| typeof v === 'symbol'
|| typeof v === 'bigint'; // eslint-disable-line valid-typeof
|| typeof v === 'bigint';
};

var stringify = function stringify( // eslint-disable-line func-name-matching
var stringify = function stringify(
object,
prefix,
generateArrayPrefix,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"browserify": "^16.5.0",
"covert": "^1.1.1",
"eclint": "^2.8.1",
"eslint": "^6.3.0",
"eslint": "^6.4.0",
"evalmd": "^0.0.19",
"for-each": "^0.3.3",
"has-symbols": "^1.0.0",
Expand Down
2 changes: 0 additions & 2 deletions test/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,6 @@ test('parse()', function (t) {
});

t.test('prefers an iso-8859-1 charset specified by the utf8 sentinel to a default charset of utf-8', function (st) {
// eslint-disable-next-line quote-props
st.deepEqual(qs.parse('utf8=' + urlEncodedNumCheckmark + '&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true, charset: 'utf-8' }), { 'ø': 'ø' });
st.end();
});
Expand All @@ -650,7 +649,6 @@ test('parse()', function (t) {
});

t.test('uses the utf8 sentinel to switch to iso-8859-1 when no default charset is given', function (st) {
// eslint-disable-next-line quote-props
st.deepEqual(qs.parse('utf8=' + urlEncodedNumCheckmark + '&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true }), { 'ø': 'ø' });
st.end();
});
Expand Down
4 changes: 2 additions & 2 deletions test/stringify.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ test('stringify()', function (t) {
});

t.test('stringifies bigints', { skip: !hasBigInt }, function (st) {
var three = BigInt(3); // eslint-disable-line new-cap
var three = BigInt(3);
var encodeWithN = function (value, defaultEncoder, charset) {
var result = defaultEncoder(value, defaultEncoder, charset);
return typeof value === 'bigint' ? result + 'n' : result; // eslint-disable-line valid-typeof
return typeof value === 'bigint' ? result + 'n' : result;
};
st.equal(qs.stringify(three), '');
st.equal(qs.stringify([three]), '0=3');
Expand Down

0 comments on commit df0cb44

Please sign in to comment.