@@ -159,9 +159,8 @@ class Functions {
159
159
) : number {
160
160
if ( isRecord ( arg ) ) {
161
161
return Object . keys ( arg ) . length ;
162
- } else {
163
- return arg . length ;
164
162
}
163
+ return arg . length ;
165
164
}
166
165
167
166
/**
@@ -194,12 +193,12 @@ class Functions {
194
193
if ( arg . length === 0 ) {
195
194
return null ;
196
195
// The signature decorator already enforces that all elements are of the same type
197
- } else if ( isNumber ( arg [ 0 ] ) ) {
196
+ }
197
+ if ( isNumber ( arg [ 0 ] ) ) {
198
198
return Math . max ( ...( arg as number [ ] ) ) ;
199
- } else {
200
- // local compare function to handle string comparison
201
- return arg . reduce ( ( a , b ) => ( a > b ? a : b ) ) ;
202
199
}
200
+ // local compare function to handle string comparison
201
+ return arg . reduce ( ( a , b ) => ( a > b ? a : b ) ) ;
203
202
}
204
203
205
204
/**
@@ -236,14 +235,13 @@ class Functions {
236
235
237
236
if ( max . visited === current . visited ) {
238
237
return max ;
239
- } else {
240
- // We can safely cast visited to number | string here because we've already
241
- // checked the type at runtime above and we know that it's either a number or a string
242
- return ( max . visited as number | string ) >
243
- ( current . visited as number | string )
244
- ? max
245
- : current ;
246
238
}
239
+ // We can safely cast visited to number | string here because we've already
240
+ // checked the type at runtime above and we know that it's either a number or a string
241
+ return ( max . visited as number | string ) >
242
+ ( current . visited as number | string )
243
+ ? max
244
+ : current ;
247
245
} , visitedArgs [ 0 ] ) ;
248
246
249
247
return max . arg ;
@@ -261,6 +259,7 @@ class Functions {
261
259
variadic : true ,
262
260
} )
263
261
public funcMerge ( ...args : Array < JSONObject > ) : JSONObject {
262
+ // biome-ignore lint/performance/noAccumulatingSpread: This is a shallow merge so the tradeoff is acceptable
264
263
return args . reduce ( ( a , b ) => ( { ...a , ...b } ) , { } ) ;
265
264
}
266
265
@@ -276,11 +275,11 @@ class Functions {
276
275
if ( arg . length === 0 ) {
277
276
return null ;
278
277
// The signature decorator already enforces that all elements are of the same type
279
- } else if ( isNumber ( arg [ 0 ] ) ) {
278
+ }
279
+ if ( isNumber ( arg [ 0 ] ) ) {
280
280
return Math . min ( ...arg ) ;
281
- } else {
282
- return arg . reduce ( ( a , b ) => ( a < b ? a : b ) ) ;
283
281
}
282
+ return arg . reduce ( ( a , b ) => ( a < b ? a : b ) ) ;
284
283
}
285
284
286
285
/**
@@ -317,14 +316,13 @@ class Functions {
317
316
318
317
if ( min . visited === current . visited ) {
319
318
return min ;
320
- } else {
321
- // We can safely cast visited to number | string here because we've already
322
- // checked the type at runtime above and we know that it's either a number or a string
323
- return ( min . visited as string | number ) <
324
- ( current . visited as string | number )
325
- ? min
326
- : current ;
327
319
}
320
+ // We can safely cast visited to number | string here because we've already
321
+ // checked the type at runtime above and we know that it's either a number or a string
322
+ return ( min . visited as string | number ) <
323
+ ( current . visited as string | number )
324
+ ? min
325
+ : current ;
328
326
} , visitedArgs [ 0 ] ) ;
329
327
330
328
return min . arg ;
@@ -415,13 +413,12 @@ class Functions {
415
413
. sort ( ( a , b ) => {
416
414
if ( a . visited === b . visited ) {
417
415
return a . index - b . index ; // Make the sort stable
418
- } else {
419
- // We can safely cast visited to number | string here because we've already
420
- // checked the type at runtime above and we know that it's either a number or a string
421
- return ( a . visited as string | number ) > ( b . visited as string | number )
422
- ? 1
423
- : - 1 ;
424
416
}
417
+ // We can safely cast visited to number | string here because we've already
418
+ // checked the type at runtime above and we know that it's either a number or a string
419
+ return ( a . visited as string | number ) > ( b . visited as string | number )
420
+ ? 1
421
+ : - 1 ;
425
422
} )
426
423
. map ( ( { value } ) => value ) ; // Extract the original values
427
424
}
@@ -484,13 +481,13 @@ class Functions {
484
481
public funcToNumber ( arg : JSONValue ) : number | null {
485
482
if ( typeof arg === 'number' ) {
486
483
return arg ;
487
- } else if ( typeof arg === 'string' ) {
484
+ }
485
+ if ( typeof arg === 'string' ) {
488
486
const num = Number ( arg ) ;
489
487
490
488
return Number . isNaN ( num ) ? null : num ;
491
- } else {
492
- return null ;
493
489
}
490
+ return null ;
494
491
}
495
492
496
493
/**
0 commit comments