source: imaps-frontend/node_modules/lodash-es/partialRight.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.5 KB
Line 
1import baseRest from './_baseRest.js';
2import createWrap from './_createWrap.js';
3import getHolder from './_getHolder.js';
4import replaceHolders from './_replaceHolders.js';
5
6/** Used to compose bitmasks for function metadata. */
7var WRAP_PARTIAL_RIGHT_FLAG = 64;
8
9/**
10 * This method is like `_.partial` except that partially applied arguments
11 * are appended to the arguments it receives.
12 *
13 * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
14 * builds, may be used as a placeholder for partially applied arguments.
15 *
16 * **Note:** This method doesn't set the "length" property of partially
17 * applied functions.
18 *
19 * @static
20 * @memberOf _
21 * @since 1.0.0
22 * @category Function
23 * @param {Function} func The function to partially apply arguments to.
24 * @param {...*} [partials] The arguments to be partially applied.
25 * @returns {Function} Returns the new partially applied function.
26 * @example
27 *
28 * function greet(greeting, name) {
29 * return greeting + ' ' + name;
30 * }
31 *
32 * var greetFred = _.partialRight(greet, 'fred');
33 * greetFred('hi');
34 * // => 'hi fred'
35 *
36 * // Partially applied with placeholders.
37 * var sayHelloTo = _.partialRight(greet, 'hello', _);
38 * sayHelloTo('fred');
39 * // => 'hello fred'
40 */
41var partialRight = baseRest(function(func, partials) {
42 var holders = replaceHolders(partials, getHolder(partialRight));
43 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
44});
45
46// Assign default placeholders.
47partialRight.placeholder = {};
48
49export default partialRight;
Note: See TracBrowser for help on using the repository browser.