https://github.com/dweinstein/node-chaotic-cb
return a callback that introduces errors with a certain ratio
https://github.com/dweinstein/node-chaotic-cb
Last synced: 4 months ago
JSON representation
return a callback that introduces errors with a certain ratio
- Host: GitHub
- URL: https://github.com/dweinstein/node-chaotic-cb
- Owner: dweinstein
- License: mit
- Created: 2015-06-12T16:33:11.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-06-12T17:30:41.000Z (over 10 years ago)
- Last Synced: 2025-09-01T19:14:08.665Z (5 months ago)
- Language: JavaScript
- Size: 113 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SYNOPSIS
Return a callback that errors randomly with a particular ratio.
# USAGE
```javascript
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](example.js)