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