Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80742 views
1
var createPartial = require('../internal/createPartial');
2
3
/** Used to compose bitmasks for wrapper metadata. */
4
var PARTIAL_RIGHT_FLAG = 64;
5
6
/**
7
* This method is like `_.partial` except that partially applied arguments
8
* are appended to those provided to the new function.
9
*
10
* The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
11
* builds, may be used as a placeholder for partially applied arguments.
12
*
13
* **Note:** This method does not set the "length" property of partially
14
* applied functions.
15
*
16
* @static
17
* @memberOf _
18
* @category Function
19
* @param {Function} func The function to partially apply arguments to.
20
* @param {...*} [partials] The arguments to be partially applied.
21
* @returns {Function} Returns the new partially applied function.
22
* @example
23
*
24
* var greet = function(greeting, name) {
25
* return greeting + ' ' + name;
26
* };
27
*
28
* var greetFred = _.partialRight(greet, 'fred');
29
* greetFred('hi');
30
* // => 'hi fred'
31
*
32
* // using placeholders
33
* var sayHelloTo = _.partialRight(greet, 'hello', _);
34
* sayHelloTo('fred');
35
* // => 'hello fred'
36
*/
37
var partialRight = createPartial(PARTIAL_RIGHT_FLAG);
38
39
// Assign default placeholders.
40
partialRight.placeholder = {};
41
42
module.exports = partialRight;
43
44