Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Powerful promise utilities for any JS environment - because who uses callbacks in 2018?
npm i promiso
Promise
defined globally (try
es6-promise polyfill)const promiso = require('promiso');
// Double a number after 1 second.
const slowDouble = (number) => {
return new Promise((resolve) => {
setTimeout(() => resolve(number * 2), 1000);
});
};
const numbers = [1, 2, 3, 4];
promiso.mapLimit(numbers, 2, slowDouble)
.then((doubled) => {
// 4 items limited to 2 concurrent executions, so this should fire after about 2 seconds.
console.log(doubled); // [2, 4, 6, 8]
});
async
/await
const promiso = require('promiso');
// Helper function for async/await.
const sleep = (time) => new Promise((resolve) => setTimeout(resolve, time));
// Triple a number after 1 second.
const slowTriple = async (number) => {
await sleep(1000);
return number * 3;
};
const numbers = [1, 2, 3, 4, 5, 6];
const main = async () => {
const tripled = await promiso.mapLimit(numbers, 3, slowTriple);
// 6 items limited to 3 concurrent executions, so this should complete after about 2 seconds.
console.log(tripled); // [3, 6, 9, 12, 15, 18]
};
main();
Promiso is transpiled from TypeScript with type definitions, so it should work out of the box with TypeScript :-)
Actual docs coming soon :-)
See the documentation for the original async library, but Promiso offers these improvements:
The following functions are available (with support planned for every function available in async):
FAQs
Powerful promise utilities for any JS environment
We found that promiso 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
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.