|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
559 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Reverses the order of arguments for a given function.
|
|---|
| 3 | *
|
|---|
| 4 | * @template T - The type of the function being flipped.
|
|---|
| 5 | * @param {T} func - The function whose arguments will be reversed.
|
|---|
| 6 | * @returns {T} A new function that takes the reversed arguments and returns the result of calling `func`.
|
|---|
| 7 | *
|
|---|
| 8 | * @example
|
|---|
| 9 | * var flipped = flip(function() {
|
|---|
| 10 | * return Array.prototype.slice.call(arguments);
|
|---|
| 11 | * });
|
|---|
| 12 | *
|
|---|
| 13 | * flipped('a', 'b', 'c', 'd');
|
|---|
| 14 | * // => ['d', 'c', 'b', 'a']
|
|---|
| 15 | */
|
|---|
| 16 | declare function flip<T extends (...args: any) => any>(func: T): T;
|
|---|
| 17 |
|
|---|
| 18 | export { flip };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.