Skip to content

Commit

Permalink
refactor: move assigning logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Rozamo committed May 30, 2024
1 parent 2821a72 commit 1e8f9e7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ajv/src/ajv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ type RequiredParamError = {
const findRequiredParamError = (
errorParams: Record<string, unknown>,
): false | RequiredParamError => {
let requiredParamError: unknown = false;

if (!errorParams.errors || !Array.isArray(errorParams.errors)) {
return false;
}

requiredParamError = errorParams.errors.find(
const requiredParamError = errorParams.errors.find(
(error: unknown) =>
isObject<Record<string, unknown>>(error) && error.keyword === 'required',
);

// Check if the correct properties are present in the error object
if (
requiredParamError &&
isObject<Record<string, unknown>>(requiredParamError) &&
Expand Down

0 comments on commit 1e8f9e7

Please sign in to comment.