1 var createWrapper = require('./internal/createWrapper'),
2 replaceHolders = require('./internal/replaceHolders'),
3 rest = require('./rest');
5 /** Used to compose bitmasks for wrapper metadata. */
9 * Creates a function that invokes `func` with `partial` arguments prepended
10 * to those provided to the new function. This method is like `_.bind` except
11 * it does **not** alter the `this` binding.
13 * The `_.partial.placeholder` value, which defaults to `_` in monolithic
14 * builds, may be used as a placeholder for partially applied arguments.
16 * **Note:** This method doesn't set the "length" property of partially
22 * @param {Function} func The function to partially apply arguments to.
23 * @param {...*} [partials] The arguments to be partially applied.
24 * @returns {Function} Returns the new partially applied function.
27 * var greet = function(greeting, name) {
28 * return greeting + ' ' + name;
31 * var sayHelloTo = _.partial(greet, 'hello');
35 * // using placeholders
36 * var greetFred = _.partial(greet, _, 'fred');
40 var partial = rest(function(func, partials) {
41 var holders = replaceHolders(partials, partial.placeholder);
42 return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders);
45 module.exports = partial;