Skip to content

Instantly share code, notes, and snippets.

@liammclennan
Created July 17, 2011 00:41
Show Gist options
  • Select an option

  • Save liammclennan/1086983 to your computer and use it in GitHub Desktop.

Select an option

Save liammclennan/1086983 to your computer and use it in GitHub Desktop.
Directly resolving dependencies in JavaScript Modules
// I'm calling this an anti-pattern because you cannot test this module
// without also testing the 'fs' module or monkey patching the require function.
var fs = require('fs');
exports.myObject = {
action: function() {
return fs.read('foo');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment