(roles: string[])
| 5 | }; |
| 6 | |
| 7 | export 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 | }; |
no test coverage detected