Projekt

Obecné

Profil

Stáhnout (636 Bajtů) Statistiky
| Větev: | Revize:
1 3a515b92 cagy
var createWrap = require('./_createWrap');
2
3
/** Used to compose bitmasks for function metadata. */
4
var WRAP_FLIP_FLAG = 512;
5
6
/**
7
 * Creates a function that invokes `func` with arguments reversed.
8
 *
9
 * @static
10
 * @memberOf _
11
 * @since 4.0.0
12
 * @category Function
13
 * @param {Function} func The function to flip arguments for.
14
 * @returns {Function} Returns the new flipped function.
15
 * @example
16
 *
17
 * var flipped = _.flip(function() {
18
 *   return _.toArray(arguments);
19
 * });
20
 *
21
 * flipped('a', 'b', 'c', 'd');
22
 * // => ['d', 'c', 'b', 'a']
23
 */
24
function flip(func) {
25
  return createWrap(func, WRAP_FLIP_FLAG);
26
}
27
28
module.exports = flip;