
Security News
New React Server Components Vulnerabilities: DoS and Source Code Exposure
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.
count-promises
Advanced tools
This library helps you count the promises created from one point in time to
another. The intent is to help you find out where promises may be coming from
in order to optimize your application. Promises can be very expensive,
especially when async_hooks are used, so it's good to keep them to a minimum
if you can.
WARNING: This works on Node.js only.
This is a Node.js package on npm. Install it how you normally would install such a package.
Import it, call it to start counting, call the result to stop counting.
import startCounter from 'count-promises'
// At some point you want to start counting promises created...
const stop = startCounter()
// Now create a bunch of promises, maybe await them. Or not! For extra fun try
// awaiting non-promises and see how many promises that creates! :D
// At this point, we want to know how many promises have been created...
const total = stop()
console.log(total, 'promises have been created since `startCounter()`')
You can also pass an options object with the following two options:
locations: Instead of returning the total number of created promises,
return an object whose keys are callsites and whose values are numbers of
promises created at those callsites. Default false.continuation: Omit from the count any promises created outside the
async continuation starting at the startCounter() call. This is useful to
eliminate any noise from other current HTTP requests, for example. Default
false.The MIT License. See LICENSE.txt
FAQs
Count all the promises created between two execution points.
The npm package count-promises receives a total of 1 weekly downloads. As such, count-promises popularity was classified as not popular.
We found that count-promises demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.