-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit function #88
Limit function #88
Conversation
readme.md
Outdated
@@ -77,6 +90,28 @@ Note: This does not cancel promises that are already running. | |||
|
|||
Get or set the concurrency limit. | |||
|
|||
### limitFunction(fn, options) | |||
|
|||
Return a function with limited concurrency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return a function with limited concurrency | |
Return a function with limited concurrency. |
This needs to clearly describe how it's different from the main export.
readme.md
Outdated
|
||
Minimum: `1` | ||
|
||
#### option |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover
readme.md
Outdated
|
||
#### concurrency | ||
|
||
Type: `number`(Interget) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
readme.md
Outdated
@@ -28,6 +28,19 @@ const result = await Promise.all(input); | |||
console.log(result); | |||
``` | |||
|
|||
```js | |||
import {limitFunction} from 'p-limit'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this example to the limitFunction API docs.
index.d.ts
Outdated
@@ -41,3 +41,22 @@ Run multiple promise-returning & async functions with limited concurrency. | |||
@returns A `limit` function. | |||
*/ | |||
export default function pLimit(concurrency: number): LimitFunction; | |||
|
|||
export type LimitFunctionOption = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plural
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, just name it Options
as I would like to make pLimit
support an options-object too, for readability.
index.d.ts
Outdated
Return a function with limited concurrency | ||
|
||
@param function_ - Promise-returning/async function. | ||
@param option | ||
@return Function with limited concurrency | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return a function with limited concurrency | |
@param function_ - Promise-returning/async function. | |
@param option | |
@return Function with limited concurrency | |
*/ | |
Return a function with limited concurrency. | |
@param function_ - Promise-returning/async function. | |
@return Function with limited concurrency. | |
*/ |
readme.md
Outdated
|
||
Return a function with limited concurrency. | ||
|
||
Note: Unlike fucntion return by `pLimit`, the return by `limitFunction` is already limited, do not need call with `limit`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple typos and does not make it super clear what the difference is. Maybe try using ChatGPT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be in index.d.ts too
No description provided.