]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/helpers/Participant.js
add seed display
[alttp.git] / resources / js / helpers / Participant.js
index af6eecc4d13aedf4f7aba5765a7218a9ee408410..8ae225c8570e59845c55891a90ecd2033e4e85b3 100644 (file)
@@ -1,3 +1,9 @@
+export const compareUsername = (a, b) => {
+       const a_name = a && a.user && a.user.username ? a.user.username : '';
+       const b_name = b && b.user && b.user.username ? b.user.username : '';
+       return a_name.localeCompare(b_name);
+};
+
 export const findResult = (participant, round) => {
        if (!participant || !participant.user_id) return null;
        if (!round || !round.results || !round.results.length) return null;
@@ -5,5 +11,6 @@ export const findResult = (participant, round) => {
 };
 
 export default {
+       compareUsername,
        findResult,
 };