2cd6abc066ec492e69e0affc784b22f84f6b8cf8
[yaffs-website] / node_modules / uncss / node_modules / lodash / curryRight.js
1 var createWrapper = require('./internal/createWrapper');
2
3 /** Used to compose bitmasks for wrapper metadata. */
4 var CURRY_RIGHT_FLAG = 16;
5
6 /**
7  * This method is like `_.curry` except that arguments are applied to `func`
8  * in the manner of `_.partialRight` instead of `_.partial`.
9  *
10  * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
11  * builds, may be used as a placeholder for provided arguments.
12  *
13  * **Note:** This method doesn't set the "length" property of curried functions.
14  *
15  * @static
16  * @memberOf _
17  * @category Function
18  * @param {Function} func The function to curry.
19  * @param {number} [arity=func.length] The arity of `func`.
20  * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
21  * @returns {Function} Returns the new curried function.
22  * @example
23  *
24  * var abc = function(a, b, c) {
25  *   return [a, b, c];
26  * };
27  *
28  * var curried = _.curryRight(abc);
29  *
30  * curried(3)(2)(1);
31  * // => [1, 2, 3]
32  *
33  * curried(2, 3)(1);
34  * // => [1, 2, 3]
35  *
36  * curried(1, 2, 3);
37  * // => [1, 2, 3]
38  *
39  * // using placeholders
40  * curried(3)(1, _)(2);
41  * // => [1, 2, 3]
42  */
43 function curryRight(func, arity, guard) {
44   arity = guard ? undefined : arity;
45   var result = createWrapper(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
46   result.placeholder = curryRight.placeholder;
47   return result;
48 }
49
50 module.exports = curryRight;