From b781db185ea519a127db22b383f4d94c0e1a04ea Mon Sep 17 00:00:00 2001 From: hovelopin Date: Fri, 24 Nov 2023 10:13:16 +0900 Subject: [PATCH] fix: change do-while -> while fix : remove unnecessary console --- react-multi-email/ReactMultiEmail.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/react-multi-email/ReactMultiEmail.tsx b/react-multi-email/ReactMultiEmail.tsx index 80938ed..7cc7ee4 100644 --- a/react-multi-email/ReactMultiEmail.tsx +++ b/react-multi-email/ReactMultiEmail.tsx @@ -101,10 +101,8 @@ export function ReactMultiEmail(props: IReactMultiEmailProps) { const setArr = new Set(value.split(re).filter(n => n)); const arr = [...setArr]; - do { - if (arr[0] === undefined) return; + while (arr.length) { const validateResult = isEmail('' + arr[0].trim()); - if (typeof validateResult === 'boolean') { if (validateResult) { addEmails('' + arr.shift()?.trim()); @@ -129,7 +127,6 @@ export function ReactMultiEmail(props: IReactMultiEmailProps) { } else { // handle promise setSpinning(true); - if ((await validateEmail?.(value)) === true) { addEmails('' + arr.shift()); setSpinning(false); @@ -141,7 +138,7 @@ export function ReactMultiEmail(props: IReactMultiEmailProps) { } } } - } while (arr.length); + } } else { if (enable && !enable({ emailCnt: emails.length })) { onDisabled?.();