MCPcopy Index your code
hub / github.com/github/awesome-copilot / sortPlugins

Function sortPlugins

website/src/scripts/pages/plugins-render.ts:35–48  ·  view source on GitHub ↗
(
  items: T[],
  sort: PluginSortOption
)

Source from the content-addressed store, hash-verified

33export type PluginSortOption = 'title' | 'lastUpdated';
34
35export function sortPlugins<T extends RenderablePlugin>(
36 items: T[],
37 sort: PluginSortOption
38): T[] {
39 return [...items].sort((a, b) => {
40 if (sort === 'lastUpdated') {
41 const dateA = a.lastUpdated ? new Date(a.lastUpdated).getTime() : 0;
42 const dateB = b.lastUpdated ? new Date(b.lastUpdated).getTime() : 0;
43 return dateB - dateA;
44 }
45
46 return a.name.localeCompare(b.name);
47 });
48}
49
50function getExternalPluginUrl(plugin: RenderablePlugin): string {
51 if (plugin.source?.source === 'github' && plugin.source.repo) {

Callers 1

sortItemsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected