]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/helpers/User.js
result reporting
[alttp.git] / resources / js / helpers / User.js
index 02230abd3e529da6b18aebe21b5e4f4e1c9eb881..2a36a39422c7f707d0bc97c0ac57c0c74cea55d7 100644 (file)
@@ -1,5 +1,12 @@
 export const getAvatarUrl = user => `//cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png`;
 
+export const findResult = (user, round) => {
+       if (!user || !user.id) return null;
+       if (!round || !round.results || !round.results.length) return null;
+       return round.results.find(result => result.user_id === user.id);
+};
+
 export default {
+       findResult,
        getAvatarUrl,
 };