File tree 2 files changed +3
-7
lines changed
2 files changed +3
-7
lines changed Original file line number Diff line number Diff line change 114
114
"is-glob" : " ^4.0.3" ,
115
115
"minimatch" : " ^3.1.2" ,
116
116
"object.fromentries" : " ^2.0.6" ,
117
+ "object.groupby" : " ^1.0.0" ,
117
118
"object.values" : " ^1.1.6" ,
118
119
"resolve" : " ^1.22.3" ,
119
120
"semver" : " ^6.3.1" ,
Original file line number Diff line number Diff line change 2
2
3
3
import minimatch from 'minimatch' ;
4
4
import includes from 'array-includes' ;
5
+ import groupBy from 'object.groupby' ;
5
6
6
7
import importType from '../core/importType' ;
7
8
import isStaticRequire from '../core/staticRequire' ;
@@ -325,13 +326,7 @@ function getSorter(alphabetizeOptions) {
325
326
}
326
327
327
328
function mutateRanksToAlphabetize ( imported , alphabetizeOptions ) {
328
- const groupedByRanks = imported . reduce ( function ( acc , importedItem ) {
329
- if ( ! Array . isArray ( acc [ importedItem . rank ] ) ) {
330
- acc [ importedItem . rank ] = [ ] ;
331
- }
332
- acc [ importedItem . rank ] . push ( importedItem ) ;
333
- return acc ;
334
- } , { } ) ;
329
+ const groupedByRanks = groupBy ( imported , ( item ) => item . rank ) ;
335
330
336
331
const sorterFn = getSorter ( alphabetizeOptions ) ;
337
332
You can’t perform that action at this time.
0 commit comments