Skip to content

Commit

Permalink
docs(curryRight): Rename parameters for clarity and update docs (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
mass2527 authored Oct 1, 2024
1 parent 832ecc5 commit 30518a8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 32 deletions.
11 changes: 5 additions & 6 deletions docs/ja/reference/function/curryRight.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
```typescript
function curryRight<R>(func: () => R): () => R;
function curryRight<P, R>(func: (p: P) => R): (p: P) => R;
function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p1: P2) => (p2: P1) => R;
function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p1: P3) => (p2: P2) => (p3: P1) => R;
function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p2: P2) => (p1: P1) => R;
function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p3: P3) => (p2: P2) => (p1: P1) => R;
function curryRight<P1, P2, P3, P4, R>(
func: (p1: P1, p2: P2, p3: P3, p4: P4) => R
): (p1: P4) => (p2: P3) => (p3: P2) => (p4: P1) => R;
): (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R;
function curryRight<P1, P2, P3, P4, P5, R>(
func: (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R
): (p1: P5) => (p2: P4) => (p3: P3) => (p4: P2) => (p5: P1) => R;
function curryRight(func: (...args: any[]) => any): (...args: any[]) => any;
): (p5: P5) => (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R;
function curryRight(func: (...args: any[]) => any): (...args: any[]) => any;
```

Expand Down Expand Up @@ -47,5 +46,5 @@ const add10 = curriedSum(10);
const add25 = add10(15);

// パラメータ `a` には値 `5` を与える必要があります。関数 'sum' はすべての引数を受け取り、値を返します。
const result = add25(5);
const result = add25(5); // 30
```
11 changes: 5 additions & 6 deletions docs/ko/reference/function/curryRight.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
```typescript
function curryRight<R>(func: () => R): () => R;
function curryRight<P, R>(func: (p: P) => R): (p: P) => R;
function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p1: P2) => (p2: P1) => R;
function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p1: P3) => (p2: P2) => (p3: P1) => R;
function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p2: P2) => (p1: P1) => R;
function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p3: P3) => (p2: P2) => (p1: P1) => R;
function curryRight<P1, P2, P3, P4, R>(
func: (p1: P1, p2: P2, p3: P3, p4: P4) => R
): (p1: P4) => (p2: P3) => (p3: P2) => (p4: P1) => R;
): (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R;
function curryRight<P1, P2, P3, P4, P5, R>(
func: (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R
): (p1: P5) => (p2: P4) => (p3: P3) => (p4: P2) => (p5: P1) => R;
function curryRight(func: (...args: any[]) => any): (...args: any[]) => any;
): (p5: P5) => (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R;
function curryRight(func: (...args: any[]) => any): (...args: any[]) => any;
```

Expand Down Expand Up @@ -47,5 +46,5 @@ const add10 = curriedSum(10);
const add25 = add10(15);

// 매개변수 `a`는 값으로 `5`를 가져요. 함수 'sum'은 모든 파라미터를 받았으므로, 이제 값을 반환해요.
const result = add25(5);
const result = add25(5); // 30
```
10 changes: 5 additions & 5 deletions docs/reference/function/curryRight.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ This method is like [curry](./curry.md), except that it curries the function fro
```typescript
function curryRight<R>(func: () => R): () => R;
function curryRight<P, R>(func: (p: P) => R): (p: P) => R;
function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p1: P2) => (p2: P1) => R;
function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p1: P3) => (p2: P2) => (p3: P1) => R;
function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p2: P2) => (p1: P1) => R;
function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p3: P3) => (p2: P2) => (p1: P1) => R;
function curryRight<P1, P2, P3, P4, R>(
func: (p1: P1, p2: P2, p3: P3, p4: P4) => R
): (p1: P4) => (p2: P3) => (p3: P2) => (p4: P1) => R;
): (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R;
function curryRight<P1, P2, P3, P4, P5, R>(
func: (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R
): (p1: P5) => (p2: P4) => (p3: P3) => (p4: P2) => (p5: P1) => R;
): (p5: P5) => (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R;
function curryRight(func: (...args: any[]) => any): (...args: any[]) => any;
```

Expand Down Expand Up @@ -46,5 +46,5 @@ const sum10 = curriedSum(10);
const sum25 = sum10(15);

// The parameter `a` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
const result = sum25(5);
const result = sum25(5); // 30
```
10 changes: 5 additions & 5 deletions docs/zh_hans/reference/function/curryRight.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
```typescript
function curryRight<R>(func: () => R): () => R;
function curryRight<P, R>(func: (p: P) => R): (p: P) => R;
function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p1: P2) => (p2: P1) => R;
function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p1: P3) => (p2: P2) => (p3: P1) => R;
function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p2: P2) => (p1: P1) => R;
function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p3: P3) => (p2: P2) => (p1: P1) => R;
function curryRight<P1, P2, P3, P4, R>(
func: (p1: P1, p2: P2, p3: P3, p4: P4) => R
): (p1: P4) => (p2: P3) => (p3: P2) => (p4: P1) => R;
): (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R;
function curryRight<P1, P2, P3, P4, P5, R>(
func: (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R
): (p1: P5) => (p2: P4) => (p3: P3) => (p4: P2) => (p5: P1) => R;
): (p5: P5) => (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R;
function curryRight(func: (...args: any[]) => any): (...args: any[]) => any;
```

Expand Down Expand Up @@ -44,5 +44,5 @@ const sum10 = curriedSum(10);
const sum25 = sum10(15);

// 参数 `a` 应该被赋值为 `5`。函数 'sum' 已经接收到了所有参数,现在将返回一个值。
const result = sum25(5);
const result = sum25(5); // 30
```
20 changes: 10 additions & 10 deletions src/function/curryRight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function curryRight<P, R>(func: (p: P) => R): (p: P) => R;
* Unlike `curry`, this function curries the function from right to left.
*
* @param {(p1: P1, p2: P2) => R} func - The function to curry.
* @returns {(p1: P2) => (p2: P1) => R} A curried function.
* @returns {(p2: P2) => (p1: P1) => R} A curried function.
*
* @example
* function twoArgFunc(a: number, b: number) {
Expand All @@ -49,15 +49,15 @@ export function curryRight<P, R>(func: (p: P) => R): (p: P) => R;
* const func = curriedTwoArgFunc(1);
* console.log(func(2)); // [2, 1]
*/
export function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p1: P2) => (p2: P1) => R;
export function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p2: P2) => (p1: P1) => R;
/**
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
*
* Unlike `curry`, this function curries the function from right to left.
*
* @param {(p1: P1, p2: P2, p3: P3) => R} func - The function to curry.
* @returns {(p1: P3) => (p2: P2) => (p3: P1) => R} A curried function.
* @returns {(p3: P3) => (p2: P2) => (p1: P1) => R} A curried function.
*
* @example
* function threeArgFunc(a: number, b: number, c: number) {
Expand All @@ -68,15 +68,15 @@ export function curryRight<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p1: P2) =>
* const func2 = func(2);
* console.log(func2(3)); // [3, 2, 1]
*/
export function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p1: P3) => (p2: P2) => (p3: P1) => R;
export function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p3: P3) => (p2: P2) => (p1: P1) => R;
/**
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
*
* Unlike `curry`, this function curries the function from right to left.
*
* @param {(p1: P1, p2: P2, p3: P3, p4: P4) => R} func - The function to curry.
* @returns {(p1: P4) => (p2: P3) => (p3: P2) => (p4: P1) => R} A curried function.
* @returns {(p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R} A curried function.
*
* @example
* function fourArgFunc(a: number, b: number, c: number, d: number) {
Expand All @@ -90,15 +90,15 @@ export function curryRight<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R):
*/
export function curryRight<P1, P2, P3, P4, R>(
func: (p1: P1, p2: P2, p3: P3, p4: P4) => R
): (p1: P4) => (p2: P3) => (p3: P2) => (p4: P1) => R;
): (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R;
/**
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
*
* Unlike `curry`, this function curries the function from right to left.
*
* @param {(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R} func - The function to curry.
* @returns {(p1: P5) => (p2: P4) => (p3: P3) => (p4: P2) => (p5: P1) => R} A curried function.
* @returns {(p5: P5) => (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R} A curried function.
*
* @example
* function fiveArgFunc(a: number, b: number, c: number, d: number, e: number) {
Expand All @@ -113,7 +113,7 @@ export function curryRight<P1, P2, P3, P4, R>(
*/
export function curryRight<P1, P2, P3, P4, P5, R>(
func: (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R
): (p1: P5) => (p2: P4) => (p3: P3) => (p4: P2) => (p5: P1) => R;
): (p5: P5) => (p4: P4) => (p3: P3) => (p2: P2) => (p1: P1) => R;
/**
* Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
* This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
Expand All @@ -137,7 +137,7 @@ export function curryRight<P1, P2, P3, P4, P5, R>(
* const add25 = add10(15);
*
* // The parameter `a` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
* const result = add25(5);
* const result = add25(5); // 30
*/
export function curryRight(func: (...args: any[]) => any): (...args: any[]) => any;
/**
Expand All @@ -163,7 +163,7 @@ export function curryRight(func: (...args: any[]) => any): (...args: any[]) => a
* const add25 = add10(15);
*
* // The parameter `a` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
* const result = add25(5);
* const result = add25(5); // 30
*/
export function curryRight(func: (...args: any[]) => any): (...args: any[]) => any {
if (func.length === 0 || func.length === 1) {
Expand Down

0 comments on commit 30518a8

Please sign in to comment.