From ef2d127e385ba2e3a5378af2ad6f17e19596347a Mon Sep 17 00:00:00 2001 From: Leonard Techel Date: Tue, 20 Jul 2021 19:38:01 +0200 Subject: [PATCH] refactor(parameters): Make this boolean assertion prettier :) --- app/src/common/hooks/api/useParameters.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/common/hooks/api/useParameters.ts b/app/src/common/hooks/api/useParameters.ts index 9a4dbfc..779fd95 100644 --- a/app/src/common/hooks/api/useParameters.ts +++ b/app/src/common/hooks/api/useParameters.ts @@ -56,7 +56,8 @@ export const useScopedParameterResponse = ( * @returns Whether any of the parameters has reached its minimum */ export const useIsGameOver = (data?: ParameterApiResponse) => { - return !data - ? false - : data.data.some(({ attributes }) => attributes.value <= attributes.min); + return ( + data && + data.data.some(({ attributes }) => attributes.value <= attributes.min) + ); };