Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tommmyy committed Nov 13, 2019
1 parent 8be494a commit 07b33e2
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/core/src/combineValidate.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import { T, compose, cond, juxt, mergeDeepLeft, flip, nthArg } from 'ramda';
import { rejectNil, isObject, mergeDeepAllWith, headArg } from 'ramda-extension';
import { T, compose, cond, juxt, flip, nthArg } from 'ramda';
import { rejectNil, mergeDeepAllWith, headArg } from 'ramda-extension';
import { isNilOrAllIsNil } from './utils';

/**
* For merging validation results.
* We don't want to null results replacing those already filled.
*/
const mergeResults = mergeDeepAllWith(
cond([
[isNilOrAllIsNil, nthArg(1)],
[flip(isNilOrAllIsNil), headArg],
[(a, b) => isObject(a) && isObject(b), mergeDeepLeft],
[T, headArg],
])
cond([[isNilOrAllIsNil, nthArg(1)], [flip(isNilOrAllIsNil), headArg], [T, headArg]])
);

/**
Expand Down

0 comments on commit 07b33e2

Please sign in to comment.