How to use the ramda-extension.mergeDeepAllWith function in ramda-extension

To help you get started, we’ve selected a few ramda-extension examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lundegaard / validarium / packages / core / src / createMainValidate.js View on Github external
* Recursively translates messages in validation result.
 */
const translate = formatMessage =>
	cond([
		[isIntlMessageWithArgs, ({ message, messageValues }) => formatMessage(message, messageValues)],
		[notNilObject, map(unlessIsNil(x => translate(formatMessage)(x)))],
		[T, identity],
	]);

const existFormatMessage = o(isFunction, path(['intl', 'formatMessage']));

/**
 * 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],
	])
);

/**
 * Applies `fns` with `values` and `props`.
 * Results of `fns` are translated with `react-intl`;
 * We assume that `props` contains `intl` object from `react-intl` (usually obtained by `injectIntl`).
 *
 * @param  {...Function} fns Validation functions.
 * @param {Object} props
 * @param {any} values