We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
recent-downloads
1 parent 2963928 commit 0b8ba2cCopy full SHA for 0b8ba2c
mirage/route-handlers/crates.js
@@ -44,6 +44,8 @@ export function list(schema, request) {
44
45
if (request.queryParams.sort === 'alpha') {
46
crates = crates.sort((a, b) => compareStrings(a.id.toLowerCase(), b.id.toLowerCase()));
47
+ } else if (request.queryParams.sort === 'recent-downloads') {
48
+ crates = crates.sort((a, b) => b.recent_downloads - a.recent_downloads);
49
}
50
51
return { ...this.serialize(crates.slice(start, end)), meta: { total: crates.length } };
0 commit comments