@@ -129,7 +129,7 @@ const qsWeirdObjects = [
129
129
[ { regexp : / ./ g } , 'regexp=' , { 'regexp' : '' } ] ,
130
130
// eslint-disable-next-line no-unescaped-regexp-dot
131
131
[ { regexp : new RegExp ( '.' , 'g' ) } , 'regexp=' , { 'regexp' : '' } ] ,
132
- [ { fn : function ( ) { } } , 'fn=' , { 'fn' : '' } ] ,
132
+ [ { fn : ( ) => { } } , 'fn=' , { 'fn' : '' } ] ,
133
133
[ { fn : new Function ( '' ) } , 'fn=' , { 'fn' : '' } ] ,
134
134
[ { math : Math } , 'math=' , { 'math' : '' } ] ,
135
135
[ { e : extendedFunction } , 'e=' , { 'e' : '' } ] ,
@@ -192,7 +192,7 @@ function check(actual, expected, input) {
192
192
`Expected keys: ${ inspect ( expectedKeys ) } ` ;
193
193
}
194
194
assert . deepStrictEqual ( actualKeys , expectedKeys , msg ) ;
195
- expectedKeys . forEach ( function ( key ) {
195
+ expectedKeys . forEach ( ( key ) => {
196
196
if ( typeof input === 'string' ) {
197
197
msg = `Input: ${ inspect ( input ) } \n` +
198
198
`Key: ${ inspect ( key ) } \n` +
@@ -206,21 +206,21 @@ function check(actual, expected, input) {
206
206
}
207
207
208
208
// test that the canonical qs is parsed properly.
209
- qsTestCases . forEach ( function ( testCase ) {
209
+ qsTestCases . forEach ( ( testCase ) => {
210
210
check ( qs . parse ( testCase [ 0 ] ) , testCase [ 2 ] , testCase [ 0 ] ) ;
211
211
} ) ;
212
212
213
213
// test that the colon test cases can do the same
214
- qsColonTestCases . forEach ( function ( testCase ) {
214
+ qsColonTestCases . forEach ( ( testCase ) => {
215
215
check ( qs . parse ( testCase [ 0 ] , ';' , ':' ) , testCase [ 2 ] , testCase [ 0 ] ) ;
216
216
} ) ;
217
217
218
218
// test the weird objects, that they get parsed properly
219
- qsWeirdObjects . forEach ( function ( testCase ) {
219
+ qsWeirdObjects . forEach ( ( testCase ) => {
220
220
check ( qs . parse ( testCase [ 1 ] ) , testCase [ 2 ] , testCase [ 1 ] ) ;
221
221
} ) ;
222
222
223
- qsNoMungeTestCases . forEach ( function ( testCase ) {
223
+ qsNoMungeTestCases . forEach ( ( testCase ) => {
224
224
assert . deepStrictEqual ( testCase [ 0 ] , qs . stringify ( testCase [ 1 ] , '&' , '=' ) ) ;
225
225
} ) ;
226
226
@@ -258,15 +258,15 @@ qsNoMungeTestCases.forEach(function(testCase) {
258
258
// now test stringifying
259
259
260
260
// basic
261
- qsTestCases . forEach ( function ( testCase ) {
261
+ qsTestCases . forEach ( ( testCase ) => {
262
262
assert . strictEqual ( testCase [ 1 ] , qs . stringify ( testCase [ 2 ] ) ) ;
263
263
} ) ;
264
264
265
- qsColonTestCases . forEach ( function ( testCase ) {
265
+ qsColonTestCases . forEach ( ( testCase ) => {
266
266
assert . strictEqual ( testCase [ 1 ] , qs . stringify ( testCase [ 2 ] , ';' , ':' ) ) ;
267
267
} ) ;
268
268
269
- qsWeirdObjects . forEach ( function ( testCase ) {
269
+ qsWeirdObjects . forEach ( ( testCase ) => {
270
270
assert . strictEqual ( testCase [ 1 ] , qs . stringify ( testCase [ 0 ] ) ) ;
271
271
} ) ;
272
272
@@ -300,7 +300,7 @@ assert.strictEqual('foo=', qs.stringify({ foo: Infinity }));
300
300
assert . strictEqual ( f , 'a=b&q=x%3Dy%26y%3Dz' ) ;
301
301
}
302
302
303
- assert . doesNotThrow ( function ( ) {
303
+ assert . doesNotThrow ( ( ) => {
304
304
qs . parse ( undefined ) ;
305
305
} ) ;
306
306
@@ -432,15 +432,15 @@ check(qs.parse('%\u0100=%\u0101'), { '%Ā': '%ā' });
432
432
}
433
433
434
434
// Test QueryString.unescapeBuffer
435
- qsUnescapeTestCases . forEach ( function ( testCase ) {
435
+ qsUnescapeTestCases . forEach ( ( testCase ) => {
436
436
assert . strictEqual ( qs . unescape ( testCase [ 0 ] ) , testCase [ 1 ] ) ;
437
437
assert . strictEqual ( qs . unescapeBuffer ( testCase [ 0 ] ) . toString ( ) , testCase [ 1 ] ) ;
438
438
} ) ;
439
439
440
440
// test overriding .unescape
441
441
{
442
442
const prevUnescape = qs . unescape ;
443
- qs . unescape = function ( str ) {
443
+ qs . unescape = ( str ) => {
444
444
return str . replace ( / o / g, '_' ) ;
445
445
} ;
446
446
check (
0 commit comments