es-toolkit 1.21.0-dev.680 → 1.21.0-dev.681

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,20 @@
1
1
  /**
2
- * Creates a function that invokes `func` with arguments reversed.
2
+ * Reverses the order of arguments for a given function.
3
3
  *
4
- * @param {F} func The function to flip arguments for.
5
- * @returns {(...args: ReverseParameters<Parameters<F>>) => ReturnType<F>} Returns the new flipped function.
4
+ * @template F - The type of the function being flipped.
5
+ * @param {F} func - The function whose arguments will be reversed.
6
+ * @returns {(...args: Reversed<Parameters<F>>) => ReturnType<F>} A new function that takes the
7
+ * reversed arguments and returns the result of calling `func`.
6
8
  *
7
9
  * @example
8
- * function fn(a: any, b: any, c: any, d: any) {
10
+ * function fn(a: string, b: string, c: string, d: string) {
9
11
  * return [a, b, c, d];
10
12
  * }
11
13
  *
12
14
  * const flipped = flip(fn);
13
15
  * flipped('a', 'b', 'c', 'd'); // => ['d', 'c', 'b', 'a']
14
16
  */
15
- declare function flip<F extends (...args: any[]) => any>(func: F): (...args: ReverseParameters<Parameters<F>>) => ReturnType<F>;
16
- type ReverseParameters<T extends any[]> = T extends [infer First, ...infer Rest] ? [...ReverseParameters<Rest>, First] : [];
17
+ declare function flip<F extends (...args: any[]) => any>(func: F): (...args: Reversed<Parameters<F>>) => ReturnType<F>;
18
+ type Reversed<T extends any[]> = T extends [infer First, ...infer Rest] ? [...Reversed<Rest>, First] : [];
17
19
 
18
20
  export { flip };
@@ -1,18 +1,20 @@
1
1
  /**
2
- * Creates a function that invokes `func` with arguments reversed.
2
+ * Reverses the order of arguments for a given function.
3
3
  *
4
- * @param {F} func The function to flip arguments for.
5
- * @returns {(...args: ReverseParameters<Parameters<F>>) => ReturnType<F>} Returns the new flipped function.
4
+ * @template F - The type of the function being flipped.
5
+ * @param {F} func - The function whose arguments will be reversed.
6
+ * @returns {(...args: Reversed<Parameters<F>>) => ReturnType<F>} A new function that takes the
7
+ * reversed arguments and returns the result of calling `func`.
6
8
  *
7
9
  * @example
8
- * function fn(a: any, b: any, c: any, d: any) {
10
+ * function fn(a: string, b: string, c: string, d: string) {
9
11
  * return [a, b, c, d];
10
12
  * }
11
13
  *
12
14
  * const flipped = flip(fn);
13
15
  * flipped('a', 'b', 'c', 'd'); // => ['d', 'c', 'b', 'a']
14
16
  */
15
- declare function flip<F extends (...args: any[]) => any>(func: F): (...args: ReverseParameters<Parameters<F>>) => ReturnType<F>;
16
- type ReverseParameters<T extends any[]> = T extends [infer First, ...infer Rest] ? [...ReverseParameters<Rest>, First] : [];
17
+ declare function flip<F extends (...args: any[]) => any>(func: F): (...args: Reversed<Parameters<F>>) => ReturnType<F>;
18
+ type Reversed<T extends any[]> = T extends [infer First, ...infer Rest] ? [...Reversed<Rest>, First] : [];
17
19
 
18
20
  export { flip };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "es-toolkit",
3
3
  "description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
4
- "version": "1.21.0-dev.680+4e926752",
4
+ "version": "1.21.0-dev.681+7eed956e",
5
5
  "homepage": "https://es-toolkit.slash.page",
6
6
  "bugs": "https://github.com/toss/es-toolkit/issues",
7
7
  "repository": {