import { curryN, converge, merge, dissocPath, pathOr } from 'ramda';
/**
* Spreads object under property path onto provided object.
*
* @func spreadPath
* @memberOf RA
* @since {@link https://char0n.github.io/ramda-adjunct/1.19.0|v1.19.0}
* @category Object
* @sig
* [Idx] -> {k: v} -> {k: v}
* Idx = String | Int
* @param {!Array.<string|number>} path The property path to spread
* @param {!Object} obj The provided object
* @return {!Object} The result of the spread
* @see {@link RA.spreadProp|spreadProp}
* @example
*
* R.spreadPath(
* ['b1', 'b2'],
* { a: 1, b1: { b2: { c: 3, d: 4 } } }
* ); // => { a: 1, c: 3, d: 4, b1 {} };
*/
const spreadPath = curryN(2, converge(merge, [dissocPath, pathOr({})]));
export default spreadPath;