You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
478 B
14 lines
478 B
const sortAnvils = (unsortedList: AnvilListItem[]): AnvilListItem[] => { |
|
const optimal: AnvilListItem[] = []; |
|
const notReady: AnvilListItem[] = []; |
|
const degraded: AnvilListItem[] = []; |
|
|
|
unsortedList.forEach((anvil) => { |
|
if (anvil.anvil_state === 'optimal') optimal.push(anvil); |
|
else if (anvil.anvil_state === 'not_ready') notReady.push(anvil); |
|
else degraded.push(anvil); |
|
}); |
|
return [...degraded, ...notReady, ...optimal]; |
|
}; |
|
|
|
export default sortAnvils;
|
|
|