File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -1528,15 +1528,23 @@ export function sortBy<T>(array: ArrayLike<T>, select: SortSelect<T>): T[] {
1528
1528
return sort ( array , ( a , b ) => defaultCompare ( select ( a ) as any , select ( b ) as any ) ) ;
1529
1529
}
1530
1530
1531
+ export function sortByFn < T > ( select : SortSelect < T > ) : ( array : ArrayLike < T > ) => T [ ] {
1532
+ return array => sortBy ( array , select ) ;
1533
+ }
1534
+
1535
+ export function sortByDescending < T > ( array : ArrayLike < T > , select : SortSelect < T > ) : T [ ] {
1536
+ return sort ( array , ( a , b ) => - defaultCompare ( select ( a ) as any , select ( b ) as any ) ) ;
1537
+ }
1538
+
1539
+ export function sortByDescendingFn < T > ( select : SortSelect < T > ) : ( array : ArrayLike < T > ) => T [ ] {
1540
+ return array => sortByDescending ( array , select ) ;
1541
+ }
1542
+
1531
1543
export type SortSelect < T > =
1532
1544
| ( ( element : T ) => boolean )
1533
1545
| ( ( element : T ) => number )
1534
1546
| ( ( element : T ) => string ) ;
1535
1547
1536
- export function sortByFn < T > ( select : SortSelect < T > ) : ( array : ArrayLike < T > ) => T [ ] {
1537
- return array => sortBy ( array , select ) ;
1538
- }
1539
-
1540
1548
export function forEach < T > (
1541
1549
array : ArrayLike < T > ,
1542
1550
f : ( element : T , index : number ) => void
You can’t perform that action at this time.
0 commit comments