1 export const compareUsername = (a, b) => {
2 const a_name = a && a.user && a.user.username ? a.user.username : '';
3 const b_name = b && b.user && b.user.username ? b.user.username : '';
4 return a_name.localeCompare(b_name);
7 export const findResult = (participant, round) => {
8 if (!participant || !participant.user_id) return null;
9 if (!round || !round.results || !round.results.length) return null;
10 return round.results.find(result => result.user_id === participant.user_id);