1 var createWrapper = require('./_createWrapper'),
2 replaceHolders = require('./_replaceHolders'),
3 rest = require('./rest');
5 /** Used to compose bitmasks for wrapper metadata. */
6 var PARTIAL_RIGHT_FLAG = 64;
9 * This method is like `_.partial` except that partially applied arguments
10 * are appended to those provided to the new function.
12 * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
13 * builds, may be used as a placeholder for partially applied arguments.
15 * **Note:** This method doesn't set the "length" property of partially
21 * @param {Function} func The function to partially apply arguments to.
22 * @param {...*} [partials] The arguments to be partially applied.
23 * @returns {Function} Returns the new partially applied function.
26 * var greet = function(greeting, name) {
27 * return greeting + ' ' + name;
30 * var greetFred = _.partialRight(greet, 'fred');
34 * // Partially applied with placeholders.
35 * var sayHelloTo = _.partialRight(greet, 'hello', _);
39 var partialRight = rest(function(func, partials) {
40 var placeholder = partialRight.placeholder,
41 holders = replaceHolders(partials, placeholder);
43 return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);
46 // Assign default placeholders.
47 partialRight.placeholder = {};
49 module.exports = partialRight;