Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Created June 17, 2015 14:19
Show Gist options
  • Save ajcrites/bafb4bbca86a92788d0d to your computer and use it in GitHub Desktop.
Save ajcrites/bafb4bbca86a92788d0d to your computer and use it in GitHub Desktop.
var assert = require("assert");
var value = runner(callback);
assert.equal(value, "correct value");
function runner(cb) {
if (true /* or some imaginary condition */) {
return cb("wrong value");
}
return cb(null, "correct value");
}
function callback(error, value) {
if (error) {
return error;
}
return value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment