Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / function / partial.js
1 var createPartial = require('../internal/createPartial');
2
3 /** Used to compose bitmasks for wrapper metadata. */
4 var PARTIAL_FLAG = 32;
5
6 /**
7  * Creates a function that invokes `func` with `partial` arguments prepended
8  * to those provided to the new function. This method is like `_.bind` except
9  * it does **not** alter the `this` binding.
10  *
11  * The `_.partial.placeholder` value, which defaults to `_` in monolithic
12  * builds, may be used as a placeholder for partially applied arguments.
13  *
14  * **Note:** This method does not set the "length" property of partially
15  * applied functions.
16  *
17  * @static
18  * @memberOf _
19  * @category Function
20  * @param {Function} func The function to partially apply arguments to.
21  * @param {...*} [partials] The arguments to be partially applied.
22  * @returns {Function} Returns the new partially applied function.
23  * @example
24  *
25  * var greet = function(greeting, name) {
26  *   return greeting + ' ' + name;
27  * };
28  *
29  * var sayHelloTo = _.partial(greet, 'hello');
30  * sayHelloTo('fred');
31  * // => 'hello fred'
32  *
33  * // using placeholders
34  * var greetFred = _.partial(greet, _, 'fred');
35  * greetFred('hi');
36  * // => 'hi fred'
37  */
38 var partial = createPartial(PARTIAL_FLAG);
39
40 // Assign default placeholders.
41 partial.placeholder = {};
42
43 module.exports = partial;