]> git.localhorst.tv Git - alttp.git/blob - resources/js/helpers/Participant.js
add seed display
[alttp.git] / resources / js / helpers / Participant.js
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);
5 };
6
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);
11 };
12
13 export default {
14         compareUsername,
15         findResult,
16 };