source: node_modules/ramda/src/partialObject.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1var mergeDeepRight =
2/*#__PURE__*/
3require("./mergeDeepRight.js");
4
5var _curry2 =
6/*#__PURE__*/
7require("./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
38var partialObject =
39/*#__PURE__*/
40_curry2((f, o) => props => f.call(this, mergeDeepRight(o, props)));
41
42module.exports = partialObject;
Note: See TracBrowser for help on using the repository browser.