X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fhelpers%2FUser.js;h=2a36a39422c7f707d0bc97c0ac57c0c74cea55d7;hb=ccaa2cf99468fea81efdf28aaa3fc72a278a95f6;hp=02230abd3e529da6b18aebe21b5e4f4e1c9eb881;hpb=edd0e97bfdc544114f30bf4c13a929631c44a555;p=alttp.git diff --git a/resources/js/helpers/User.js b/resources/js/helpers/User.js index 02230ab..2a36a39 100644 --- a/resources/js/helpers/User.js +++ b/resources/js/helpers/User.js @@ -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, };