source: trip-planner-front/node_modules/lodash/partialRight.js@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1var baseRest = require('./_baseRest'),
2 createWrap = require('./_createWrap'),
3 getHolder = require('./_getHolder'),
4 replaceHolders = require('./_replaceHolders');
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
49module.exports = partialRight;
Note: See TracBrowser for help on using the repository browser.