Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const formatRegExp = /%[sdj%]/g;

declare var ASYNC_VALIDATOR_NO_WARNING;

export let warning: (type: string, errors: SyncErrorType[]) => void = () => {};
export let warning: (type: string, errors: SyncErrorType[]) => void = () => { };

// don't print warning message when in production env or node runtime
if (
Expand Down Expand Up @@ -155,7 +155,11 @@ function asyncSerialArray(
const original = index;
index = index + 1;
if (original < arrLength) {
func(arr[original], next);
func(arr[original], function (errors) {
queueMicrotask(() => {
next(errors);
})
});
} else {
callback([]);
}
Expand Down Expand Up @@ -229,8 +233,8 @@ export function asyncMap(
callback(results);
return results.length
? reject(
new AsyncValidationError(results, convertFieldsError(results)),
)
new AsyncValidationError(results, convertFieldsError(results)),
)
: resolve(source);
}
};
Expand Down