File tree Expand file tree Collapse file tree 3 files changed +3
-6
lines changed
Expand file tree Collapse file tree 3 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,7 @@ export const groupToMapBy = <K, V>(
2020) : ReadonlyMap < K , NonEmptyArray < V > > =>
2121 [ ...items ] . reduce ( ( map , item ) => {
2222 const groupKey = by ( item ) ;
23- let prev : readonly V [ ] | undefined = map . get ( groupKey ) ;
24- prev = prev ? prev : [ ] ;
23+ const prev : readonly V [ ] | undefined = map . get ( groupKey ) ?? [ ] ;
2524 map . set ( groupKey , asNonEmptyArray ( [ ...prev , item ] ) ! ) ;
2625 return map ;
2726 } , new Map < K , NonEmptyArray < V > > ( ) ) ;
Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ const wrapInspect = <TThis>(
198198 } ;
199199
200200 return function ( depth , options , inspect ) {
201- depth = depth != null ? depth : Infinity ;
201+ depth ??= Infinity ;
202202 return fn . call ( this , {
203203 ...options ,
204204 depth,
Original file line number Diff line number Diff line change @@ -13,9 +13,7 @@ export function sortBy<T>(
1313 list : Iterable < T > ,
1414 criteria ?: SortCriteria < T > ,
1515) : readonly T [ ] {
16- return [ ...list ] . sort (
17- cmpBy ( criteria ? criteria : ( x : T ) => x as SortableValue ) ,
18- ) ;
16+ return [ ...list ] . sort ( cmpBy ( criteria ?? ( ( x : T ) => x as SortableValue ) ) ) ;
1917}
2018
2119export const cmpBy = < T > ( criteria : SortCriteria < T > ) => {
You can’t perform that action at this time.
0 commit comments