1 | var mergeDeepRight =
|
---|
2 | /*#__PURE__*/
|
---|
3 | require("./mergeDeepRight.js");
|
---|
4 |
|
---|
5 | var _curry2 =
|
---|
6 | /*#__PURE__*/
|
---|
7 | require("./internal/_curry2.js");
|
---|
8 | /**
|
---|
9 | * Takes a function `f` and an object, and returns a function `g`.
|
---|
10 | * When applied, `g` returns the result of applying `f` to the object
|
---|
11 | * provided initially merged deeply (right) with the object provided as an argument to `g`.
|
---|
12 | *
|
---|
13 | * @func
|
---|
14 | * @memberOf R
|
---|
15 | * @since v0.28.0
|
---|
16 | * @category Function
|
---|
17 | * @sig (({ a, b, c, ..., n }) -> x) -> { a, b, c, ...} -> ({ d, e, f, ..., n } -> x)
|
---|
18 | * @param {Function} f
|
---|
19 | * @param {Object} props
|
---|
20 | * @return {Function}
|
---|
21 | * @see R.partial, R.partialRight, R.curry, R.mergeDeepRight
|
---|
22 | * @example
|
---|
23 | *
|
---|
24 | * const multiply2 = ({ a, b }) => a * b;
|
---|
25 | * const double = R.partialObject(multiply2, { a: 2 });
|
---|
26 | * double({ b: 2 }); //=> 4
|
---|
27 | *
|
---|
28 | * const greet = ({ salutation, title, firstName, lastName }) =>
|
---|
29 | * salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!';
|
---|
30 | *
|
---|
31 | * const sayHello = R.partialObject(greet, { salutation: 'Hello' });
|
---|
32 | * const sayHelloToMs = R.partialObject(sayHello, { title: 'Ms.' });
|
---|
33 | * sayHelloToMs({ firstName: 'Jane', lastName: 'Jones' }); //=> 'Hello, Ms. Jane Jones!'
|
---|
34 | * @symb R.partialObject(f, { a, b })({ c, d }) = f({ a, b, c, d })
|
---|
35 | */
|
---|
36 |
|
---|
37 |
|
---|
38 | var partialObject =
|
---|
39 | /*#__PURE__*/
|
---|
40 | _curry2((f, o) => props => f.call(this, mergeDeepRight(o, props)));
|
---|
41 |
|
---|
42 | module.exports = partialObject; |
---|