Skip to content

Commit

Permalink
refactor: rename merge to stitch because it is cooler
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Aug 16, 2024
1 parent 5dc5964 commit 40cc79d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/validation/useValidationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function useValidationProvider<
return createValidationResult({
isValid: !fieldErrors.length,
errors: fieldErrors,
output: mergeOutputs(getValues() as unknown as TOutput, results),
output: stitchOutput(getValues() as unknown as TOutput, results),
});
}

Expand All @@ -62,7 +62,7 @@ export function useValidationProvider<
return createValidationResult({
isValid: !allErrors.length,
errors: allErrors,
output: mergeOutputs(output ?? (getValues() as unknown as TOutput), results),
output: stitchOutput(output ?? (getValues() as unknown as TOutput), results),
});
}

Expand Down Expand Up @@ -99,7 +99,7 @@ export function useValidationProvider<
} as TResult;
}

function mergeOutputs(base: TOutput, results: (ValidationResult | GroupValidationResult)[]): TOutput {
function stitchOutput(base: TOutput, results: (ValidationResult | GroupValidationResult)[]): TOutput {
const all = cloneDeep(base);
// Make sure we start with groups first since it may override individual fields
const sorted = [...results].sort((a, b) => {
Expand Down

0 comments on commit 40cc79d

Please sign in to comment.