From f78188086d2eabd7e3ba7f94a41322f7501d1ee7 Mon Sep 17 00:00:00 2001 From: Vrishab Srivatsa Date: Wed, 20 Mar 2024 16:26:32 +0530 Subject: [PATCH] refactor: array.reduce refactor --- src/Utilities/DynamicFieldsUtils.res | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Utilities/DynamicFieldsUtils.res b/src/Utilities/DynamicFieldsUtils.res index e67c5311a..45e0c5800 100644 --- a/src/Utilities/DynamicFieldsUtils.res +++ b/src/Utilities/DynamicFieldsUtils.res @@ -162,9 +162,9 @@ let useRequiredFieldsEmptyAndValid = ( setAreRequiredFieldsValid(_ => areRequiredFieldsValid) let areRequiredFieldsEmpty = - fieldsArrWithBillingAddress->Js.Array2.reduce((acc, paymentMethodFields) => { + fieldsArrWithBillingAddress->Array.reduce(false, (acc, paymentMethodFields: PaymentMethodsRecord.paymentMethodsFields) => { acc || - switch paymentMethodFields { + switch (paymentMethodFields) { | Email => email.value === "" | FullName => fullName.value === "" | Country => country === "" && countryNames->Array.length > 0 @@ -198,7 +198,7 @@ let useRequiredFieldsEmptyAndValid = ( month === "" || year === "" || cvcNumber === "" | _ => false } - }, false) + }) setAreRequiredFieldsEmpty(_ => areRequiredFieldsEmpty) None }, (