Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
636 bytes
|
Line | |
---|
1 | 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;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.