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.
Why have an if statement when you can have an if function?
A special case solution for callback hell that focuses on developer ease-of-use. Executes your functions in series or parallel, tracks errors and results, and provides conditionals.
If you're using this plugin module, feel free to contact me on twitter if you have any questions! :) @rjrodger
Current Version: 0.0.2
Tested on: Node 0.10.31
npm install zig
Here's the classic Mongo example. Look ma, no callbacks! Nice and linear down the page.
var zig = require('..')
var MongoClient = require('mongodb').MongoClient
var format = require('util').format;
var db,collection
zig({trace:false})
.wait(function(data,done){
MongoClient.connect('mongodb://127.0.0.1:27017/test', done)
})
.step(function(data){
db = data
return collection = db.collection('test_insert')
})
.wait(function(data,done){
collection.insert({a:2},done)
})
.wait(function(data,done){
collection.count(done)
})
.step(function(count){
console.log(format("count = %s", count));
return true;
})
.wait(function(data,done){
collection.find().toArray(done)
})
.end(function(err,docs){
if( err ) return console.log(err);
console.dir(docs)
db.close()
})
And the original, callback hell:
var MongoClient = require('mongodb').MongoClient
, format = require('util').format;
MongoClient.connect('mongodb://127.0.0.1:27017/test', function(err, db) {
if(err) throw err;
var collection = db.collection('test_insert');
collection.insert({a:2}, function(err, docs) {
collection.count(function(err, count) {
console.log(format("count = %s", count));
});
collection.find().toArray(function(err, results) {
console.dir(results);
db.close();
});
});
})
npm test
FAQs
Simple, but naughty, control flow for Node.js.
The npm package zig receives a total of 48 weekly downloads. As such, zig popularity was classified as not popular.
We found that zig 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.