1 var baseRest = require('./_baseRest'),
2 createWrap = require('./_createWrap'),
3 getHolder = require('./_getHolder'),
4 replaceHolders = require('./_replaceHolders');
6 /** Used to compose bitmasks for function metadata. */
7 var WRAP_PARTIAL_FLAG = 32;
10 * Creates a function that invokes `func` with `partials` prepended to the
11 * arguments it receives. This method is like `_.bind` except it does **not**
12 * alter the `this` binding.
14 * The `_.partial.placeholder` value, which defaults to `_` in monolithic
15 * builds, may be used as a placeholder for partially applied arguments.
17 * **Note:** This method doesn't set the "length" property of partially
24 * @param {Function} func The function to partially apply arguments to.
25 * @param {...*} [partials] The arguments to be partially applied.
26 * @returns {Function} Returns the new partially applied function.
29 * function greet(greeting, name) {
30 * return greeting + ' ' + name;
33 * var sayHelloTo = _.partial(greet, 'hello');
37 * // Partially applied with placeholders.
38 * var greetFred = _.partial(greet, _, 'fred');
42 var partial = baseRest(function(func, partials) {
43 var holders = replaceHolders(partials, getHolder(partial));
44 return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
47 // Assign default placeholders.
48 partial.placeholder = {};
50 module.exports = partial;