Skip to content

Instantly share code, notes, and snippets.

@MylesBorins
Created December 30, 2014 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MylesBorins/c26750a1d414a9d2ddeb to your computer and use it in GitHub Desktop.
Save MylesBorins/c26750a1d414a9d2ddeb to your computer and use it in GitHub Desktop.
Ruhroh Closure
var stub = require('./stub');
stub.home().woops().maybe();
'use strict';
var ctx = {
payload: 'as expected'
};
exports.home = function () {
ctx.error = 'OMG AN ERROR';
ctx.sensitiveData = ['oh', 'shit', 'son'];
return exports;
};
exports.woops = function () {
console.log(ctx.error);
if (ctx.sensitiveData) {
ctx.payload = 'I\'m in ur tronz';
}
return exports;
};
exports.maybe = function () {
console.log(ctx.payload);
return exports;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment