Skip to content

Commit

Permalink
fix: change do-while -> while
Browse files Browse the repository at this point in the history
fix : remove unnecessary console
  • Loading branch information
hovelopin committed Nov 24, 2023
1 parent cd67383 commit b781db1
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions react-multi-email/ReactMultiEmail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -129,7 +127,6 @@ export function ReactMultiEmail(props: IReactMultiEmailProps) {
} else {
// handle promise
setSpinning(true);

if ((await validateEmail?.(value)) === true) {
addEmails('' + arr.shift());
setSpinning(false);
Expand All @@ -141,7 +138,7 @@ export function ReactMultiEmail(props: IReactMultiEmailProps) {
}
}
}
} while (arr.length);
}
} else {
if (enable && !enable({ emailCnt: emails.length })) {
onDisabled?.();
Expand Down

0 comments on commit b781db1

Please sign in to comment.