MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / sortBy

Function sortBy

src/shared/utils/array.ts:1–9  ·  view source on GitHub ↗
(items: T[], f: (item: T) => any)

Source from the content-addressed store, hash-verified

1export function sortBy<T>(items: T[], f: (item: T) => any): T[] {
2 return items.sort((item1, item2) => {
3 const r1 = f(item1);
4 const r2 = f(item2);
5 if (r1 < r2) return -1;
6 if (r1 > r2) return 1;
7 return 0;
8 });
9}
10
11
12export function unique<T>(items: T[]): T[] {

Callers 8

makeTestTextTreeFunction · 0.90
dart_cli.test.tsFile · 0.90
variablesRequestFunction · 0.90
findProjectFoldersFunction · 0.90
createDartProjectMethod · 0.90
getFilesAndFoldersMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected