dweinstein / node-chaotic-cb

return a callback that introduces errors with a certain ratio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SYNOPSIS

Return a callback that errors randomly with a particular ratio.

USAGE

var chaos = require('chaotic-cb')(0.9);

var cb = chaos(function(err, res) { console.log(err?err:res); });
cb(null, "testing...");

var cb = chaos(0.9, function(err, res) { console.log(err?err:res); });
cb(null, "I probably won't happen...");

See the example

About

return a callback that introduces errors with a certain ratio

License:MIT License


Languages

Language:JavaScript 100.0%