You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'd like to propose introducing a limit.with API to streamline the process of creating limited functions with Array.prototype.map()
Current API:
constlimit=pLimit(5)// With inline functionawaitPromise.all(items.map(item=>limit(async()=>{awaitprocess(item)})))// With function declarationasyncfunctionprocessItem(item){awaitprocess(item)}awaitPromise.all(items.map(item=>limit(()=>processItem(item))))
Proposed API:
constlimit=pLimit(5)// With inline functionawaitPromise.all(items.map(limit.with(asyncitem=>{awaitprocess(item)})))// With function declarationasyncfunctionprocessItem(item){awaitprocess(item)}awaitPromise.all(items.map(limit.with(processItem)))
While the difference is subtle, the intention is to remove some boilerplate and improve readability. I put together a POC here and am happy to follow up with documentation, any API/naming/etc changes, and opening a PR
The text was updated successfully, but these errors were encountered:
Hello, I'd like to propose introducing a
limit.with
API to streamline the process of creating limited functions withArray.prototype.map()
Current API:
Proposed API:
While the difference is subtle, the intention is to remove some boilerplate and improve readability. I put together a POC here and am happy to follow up with documentation, any API/naming/etc changes, and opening a PR
The text was updated successfully, but these errors were encountered: