Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Generator based control flow that supports both callbacks and promises.
Many of the existing async libraries require wrapping callback functions into promises to be usuable, which creates unnecessary complication.
In caco, both callbacks and promises are 'yieldable'; resulting function can be used by both callbacks and promises. This enables a powerful control flow while maintaining compatibility.
npm install caco
var caco = require('caco')
var fn = caco(function * (next) {
var foo = yield Promise.resolve('bar') // yield promise
yield setTimeout(next, 100) // yield callback using 'next' argument
// try/catch errors
try {
yield Promise.reject('boom')
} catch (err) {
console.log(err) // 'boom'
}
var data = yield fs.readFile('./foo/bar', next)
return data
})
// consume with callback
fn(function (err, res) { })
fn().then(...).catch(...)
Wraps a generator into a regular function that acceots callback or promise.
var getN = caco(function * (n, next) {
if (n === 689) yield Promise.reject('boom') // yield reject throws error
return yield Promise.resolve(n)
})
getN(123, function (err, val) {
console.log(val) // 123
})
getN(123).then(...)
getN(689).catch(function (err) {
console.log(err) // boom
})
Generator accepts optional next
argument for yieldable callback
MIT
FAQs
Generator based control flow that supports both callbacks and promises
The npm package caco receives a total of 3 weekly downloads. As such, caco popularity was classified as not popular.
We found that caco 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
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.