MCPcopy Create free account
hub / github.com/bytebase/bytebase / priority

Function priority

frontend/src/utils/iam/role.ts:9–15  ·  view source on GitHub ↗
(role: string)

Source from the content-addressed store, hash-verified

7export const sortRoles = (roles: string[]) => {
8 return roles.sort((a, b) => {
9 const priority = (role: string) => {
10 const presetRoleIndex = PRESET_ROLES.indexOf(role);
11 if (presetRoleIndex !== -1) {
12 return presetRoleIndex;
13 }
14 return PRESET_ROLES.length + roles.indexOf(role);
15 };
16 return priority(a) - priority(b);
17 });
18};

Callers 1

sortRolesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected