@@ -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' : '' } ] ,
@@ -189,7 +189,7 @@ function check(actual, expected, input) {
189
189
`Expected keys: ${ inspect ( expectedKeys ) } ` ;
190
190
}
191
191
assert . deepStrictEqual ( actualKeys , expectedKeys , msg ) ;
192
- expectedKeys . forEach ( function ( key ) {
192
+ expectedKeys . forEach ( ( key ) => {
193
193
if ( typeof input === 'string' ) {
194
194
msg = `Input: ${ inspect ( input ) } \n` +
195
195
`Key: ${ inspect ( key ) } \n` +
@@ -203,21 +203,21 @@ function check(actual, expected, input) {
203
203
}
204
204
205
205
// test that the canonical qs is parsed properly.
206
- qsTestCases . forEach ( function ( testCase ) {
206
+ qsTestCases . forEach ( ( testCase ) => {
207
207
check ( qs . parse ( testCase [ 0 ] ) , testCase [ 2 ] , testCase [ 0 ] ) ;
208
208
} ) ;
209
209
210
210
// test that the colon test cases can do the same
211
- qsColonTestCases . forEach ( function ( testCase ) {
211
+ qsColonTestCases . forEach ( ( testCase ) => {
212
212
check ( qs . parse ( testCase [ 0 ] , ';' , ':' ) , testCase [ 2 ] , testCase [ 0 ] ) ;
213
213
} ) ;
214
214
215
215
// test the weird objects, that they get parsed properly
216
- qsWeirdObjects . forEach ( function ( testCase ) {
216
+ qsWeirdObjects . forEach ( ( testCase ) => {
217
217
check ( qs . parse ( testCase [ 1 ] ) , testCase [ 2 ] , testCase [ 1 ] ) ;
218
218
} ) ;
219
219
220
- qsNoMungeTestCases . forEach ( function ( testCase ) {
220
+ qsNoMungeTestCases . forEach ( ( testCase ) => {
221
221
assert . deepStrictEqual ( testCase [ 0 ] , qs . stringify ( testCase [ 1 ] , '&' , '=' ) ) ;
222
222
} ) ;
223
223
@@ -255,15 +255,15 @@ qsNoMungeTestCases.forEach(function(testCase) {
255
255
// now test stringifying
256
256
257
257
// basic
258
- qsTestCases . forEach ( function ( testCase ) {
258
+ qsTestCases . forEach ( ( testCase ) => {
259
259
assert . strictEqual ( testCase [ 1 ] , qs . stringify ( testCase [ 2 ] ) ) ;
260
260
} ) ;
261
261
262
- qsColonTestCases . forEach ( function ( testCase ) {
262
+ qsColonTestCases . forEach ( ( testCase ) => {
263
263
assert . strictEqual ( testCase [ 1 ] , qs . stringify ( testCase [ 2 ] , ';' , ':' ) ) ;
264
264
} ) ;
265
265
266
- qsWeirdObjects . forEach ( function ( testCase ) {
266
+ qsWeirdObjects . forEach ( ( testCase ) => {
267
267
assert . strictEqual ( testCase [ 1 ] , qs . stringify ( testCase [ 0 ] ) ) ;
268
268
} ) ;
269
269
@@ -292,7 +292,7 @@ assert.strictEqual('foo=', qs.stringify({ foo: Infinity }));
292
292
assert . strictEqual ( f , 'a=b&q=x%3Dy%26y%3Dz' ) ;
293
293
}
294
294
295
- assert . doesNotThrow ( function ( ) {
295
+ assert . doesNotThrow ( ( ) => {
296
296
qs . parse ( undefined ) ;
297
297
} ) ;
298
298
@@ -423,15 +423,15 @@ check(qs.parse('%\u0100=%\u0101'), { '%Ā': '%ā' });
423
423
}
424
424
425
425
// Test QueryString.unescapeBuffer
426
- qsUnescapeTestCases . forEach ( function ( testCase ) {
426
+ qsUnescapeTestCases . forEach ( ( testCase ) => {
427
427
assert . strictEqual ( qs . unescape ( testCase [ 0 ] ) , testCase [ 1 ] ) ;
428
428
assert . strictEqual ( qs . unescapeBuffer ( testCase [ 0 ] ) . toString ( ) , testCase [ 1 ] ) ;
429
429
} ) ;
430
430
431
431
// test overriding .unescape
432
432
{
433
433
const prevUnescape = qs . unescape ;
434
- qs . unescape = function ( str ) {
434
+ qs . unescape = ( str ) => {
435
435
return str . replace ( / o / g, '_' ) ;
436
436
} ;
437
437
check (
0 commit comments